filter props to validate to only those of type Uri

This commit is contained in:
Collin M. Barrett 2019-07-01 15:37:57 -05:00
parent 3ddc697ed1
commit 63b33a20ac

View file

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