I have a an array, that has data, howeever when I want to filter that array using linq Where, I am getting exception Object reference not set to an instance of an object.
so What I have
var images = await _repository.DeleteMerchantProductAsync(baseProductId, userId);
now I f I do images.count I get 1
However when I do images[0] it return null.
if (!images.Any())
{
return false;
}
var paths = images
.Where(i => !string.IsNullOrWhiteSpace(i.FileName))
.Select(i => i.FileName)
.ToList();
it throws exception at
var paths = images
.Where(i => !string.IsNullOrWhiteSpace(i.FileName))
.Select(i => i.FileName)
.ToList();
Any reason ?