I have the following code:
var questionStatuses =
(
from questionStatus in this._questionStatusService.GetQuestionStatuses()
select new
{
id = questionStatus.QuestionStatusId,
status = questionStatus.Status
}
);
if (questionStatuses == null || questionStatuses.length() == 0)
{
return Request.CreateResponse(HttpStatusCode.NotFound);
}
else
{
var response = Request.CreateResponse(HttpStatusCode.OK, questionStatuses);
return response;
}
questionStatuses is an IEnumrable.
How can I check to ensure this has content as is not just an empty array? I tried .length() but it gives an error. Also this is part of a WebAPI controller so is it okay to return IEnumerable or should I make it into a list and if so how can I do that?