simplify prop value extraction

This commit is contained in:
Collin M. Barrett 2019-07-01 15:45:20 -05:00
parent 9e9bb5ebfd
commit 821a0ec0d2

View file

@ -24,8 +24,8 @@ public async Task<IEnumerable<Uri>> GetAllAsync<TModel>()
var request = new RestRequest(endpoint);
var response = await _apiClient.ExecuteAsync<IEnumerable<TModel>>(request);
return response.SelectMany(r =>
r.GetType().GetProperties().Where(p => p.GetType() == typeof(Uri)).Select(p => (Uri)p.GetValue(r)))
.Where(u => u != null);
r.GetType().GetProperties().Where(p => p.GetType() == typeof(Uri) && p.GetValue(r) != null)
.Select(p => (Uri)p.GetValue(r)));
}
private static string BuildEndpoint<TModel>()