using System.Collections.Generic;
public static class MainClass
public static class SubClass
public static string str { get; set; }
public const long poperty1 = 365635;
public const long poperty2 = 156346;
public const long poperty3 = 280847;
public static class SubClass2
public const long poperty4 = 36351526;
public const long poperty6 = 152415;
public const long poperty7 = 280114157;
public static bool FindProperty(string className, IEnumerable<long> list)
var allSubClass = typeof(MainClass).GetMembers().Where(m => m.MemberType == System.Reflection.MemberTypes.NestedType);
var classLookingFor = allSubClass.FirstOrDefault(c => string.Equals(c.Name, className, System.StringComparison.InvariantCultureIgnoreCase));
if (classLookingFor == null)
Console.WriteLine("Class {0} not found.", className);
var allProp = (classLookingFor as TypeInfo).DeclaredFields.Where(f => f.FieldType == typeof(long));
var anyPropWithValue = allProp.Any(p => list.Any(lng => lng == (long)p.GetValue(null)));
public static void Main()
var list = new List<long> { 36351526, 365635, 280847 };
Console.WriteLine(MainClass.FindProperty("SubClass", list) ? "At least one property found" : "Could not find any property that hold any of the value passed in.");
Console.WriteLine(MainClass.FindProperty("SubClass2", list) ? "At least one property found" : "Could not find any property that hold any of the value passed in.");
Console.WriteLine(MainClass.FindProperty("SubClass24", list) ? "At least one property found" : "Could not find any property that hold any of the value passed in.");