'c# data count query

I have a Treatment List and their languages. When I send a LanguageId, if my incoming list is empty, I want to return 2 LanguageIds. Everything is fine, but how do I say if data=0?

 public async Task<ApiResponse<IEnumerable<TreatmentResponse>>> Handle(TreatmentsQuery request, CancellationToken cancellationToken)
    {
        IEnumerable<Treatment> data = await _repo.Treatment.GetByCurrencyIdAsync(request.CurrencyId, request.languageId, request.predicate);

        if (data==null)
        {
            var b = await _repo.Language.GetByIdAsync(a => a.isDefault == true);

            var c = request.languageId == b.Id;              
        }

        var response = _mapper.Map<IEnumerable<TreatmentResponse>>(data);

        return new SuccessApiResponse<IEnumerable<TreatmentResponse>>(response);
    }

In the above scenario, data count is 0 but not looped. enter image description here enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source