I'm making a call to Azure Cosmos DB where I know the data I'm querying does NOT exist.
I was expecting to get a null value but instead I'm getting:
Enumeration yielded no results
How do I test whether I received a value or not? I was testing for null which doesn't work because the outcome is not null.
My code looks something like this:
var result = await _client.ReadQuery<myObject>(AccountsCollection, sql, pa);
if(result == null)
return null;

.Any()in addition tonull:if(result == null || !result.Any())nullorAny(). I think it has something to do with theasynccall. I guess I'm getting a promise not a result.varonly when the type is obvious (i.e var foo = new DateTime()). Also, make sure your any logic matches what I put in the comment above. If result is null OR result does NOT have anyHttpClientto read from Cosmos instead of the Cosmos library. Any reason for that?!beforeAny(). I am using Cosmos DB library. I'm not usingHttpClient. I placed my Cosmos DB logic in a different class which I called_clientwhich is only a wrapper around Cosmos DB library. Thank you for your help!