I'm trying to use this linq query to check if certain object's netIds are null, blank, or otherwise empty.
var badData = FileSignatures.Drive.Public.Where(
e => String.IsNullOrWhiteSpace(
e.NetworkBlock?.Select(n => n.netId)) &&
String.IsNullOrWhiteSpace(
e.WiFiBlock?.netId) &&
String.IsNullOrWhiteSpace(
e.BluetoothBlock?.netId))
.ToList();
WiFiBlock and BluetoothBlock are both just single objects so the above should work.
However, NetworkBlock is an array of objects so I need to figure out how to iterate through each object in NetworkBlock and check it's netId.
Is it possible to do something like that inside a linq query?
Thanks!
e.NetworkBlock?.Any(n => String.IsNullOrWhitespace(n.Id))or something of that nature. It's an enumeration; you can do anything with it in that lambda that you could anywhere else.