static void Main(string[] args) { SomeDTO dto = new SomeDTO(); var propEnum = dto.GivePropertyEnumerator<bool>("^Arrange"); propEnum.GetClassAttributes<TableHeaderAttribute>().Any(a => { Console.WriteLine("entity has header: " + a.HeaderText); return true; }); var countFalse = (from pvo in propEnum where pvo.Value == false select pvo); countFalse.Any(x => { if (x.GetAttribute<DisplayAttribute>().Any(a => { Console.WriteLine("Attribute text " + a.Name); return true; })) { Console.WriteLine("Found attribute"); } else { Console.WriteLine("Didn't find attribute"); } Console.WriteLine(string.Format("{0}: {1}", x.PropertyInfo.Name, x.Value)); return false; }); Console.WriteLine("Non authorized count: " + countFalse.Count()); Console.ReadKey(); }
static void Main(string[] args) { SomeDTO dto = new SomeDTO(); int countFalse = 0; PropertyIterator.ForEach <bool>(dto, "^Arrange", (p, v, o) => { Console.WriteLine(string.Format("{0}: {1}", p.Name, v)); if (v == false) { countFalse++; } }); Console.WriteLine("Non authorized count: " + countFalse); Console.ReadKey(); }
static void Main(string[] args) { SomeDTO dto = new SomeDTO(); int countFalse = 0; PropertyIterator.ForEach<bool>(dto, "^Arrange", (p, v, o) => { Console.WriteLine(string.Format("{0}: {1}", p.Name, v)); if (v == false) { countFalse++; } }); Console.WriteLine("Non authorized count: " + countFalse); Console.ReadKey(); }