Skip to content

Instantly share code, notes, and snippets.

@nekitozzz
Last active August 29, 2015 14:05
Show Gist options
  • Save nekitozzz/e2417a9e070ed3020f38 to your computer and use it in GitHub Desktop.
Save nekitozzz/e2417a9e070ed3020f38 to your computer and use it in GitHub Desktop.
Iterate by properties C# using reflection
//Выбираем все строки, в которых содержатся хоть какие-то данные
var nonEmptyItems =
items.Where(
i => i.GetType()
.GetProperties()
.Any(p => !string.IsNullOrWhiteSpace(p.GetValue(i) as string)))
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment