For some reason, I cannot change the request, so I have to do this in C #.
I have a class:
public class myClass
{
int id { get; set; }
string name { get; set; }
DateTime sDate { get; set; }
bool status { get; set; }
}
The data that I receive is displayed in this list. Now I want to remove these properties from the list with values null. I may seem crazy, but you read it right. I was thinking of creating another list with only the selected properties, but any of the above properties may be null. Therefore, I must develop a filtering mechanism for my list based on this.
For clarity, consider the following example.
List<myClass> lstClass = some data source.
After receiving the data, the general list (lstClass) is as follows. Consider the result set in the table:
Id Name Sdate status
1 a null null
2 b null null
3 c null false
- sdate.
, , .
Id Name status
1 a null
2 b null
3 c false
? Linq?
PS: . , , , .