[Solved] Find name of member in list


You can get the values of your properties using Reflection and then use LINQ to get name of the property that has the value of 100:

var userType = typeof(User);
var properties = userType
                .GetProperties()
                .Where(x => x.Name.StartsWith("Value")).ToList();

foreach (var user in LiUsers)
{
    var property  = properties.FirstOrDefault(x => (int)x.GetValue(user) == 100);
    if(property != null)
    {
        string name = property.Name;
    }
}

9

solved Find name of member in list