In the following code for a custom HttpClient, I found a method take takes an interface and writes to it as if it was an object with properties:
public async Task<T> GetAsync<T>(ICacheContext cacheContext = null) {
try {
T result = default(T);
// check if value is cached
if (cacheContext != null) {
result = await GetResultFromCache<T>(cacheContext);
if (result != null) {
cacheContext.IsDataFromCache = true;
return result;
}
}
I'm a bit confused by cacheContext.IsDataFromCache = true;
. Why would you set the property of an interface? Isn't that something you'd do to the object implementation of said interface?