Answers for "get property of object list c#"

C#
5

c# list of properties from list of objects

List<string> firstNames = people.Select(person => person.FirstName).ToList();
Posted by: Guest on May-11-2020
0

c# get property type of list

var obj = new PropClassDemo();
foreach (PropertyInfo prop in obj.GetType().GetProperties())
{
	if(prop.PropertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(prop.PropertyType))
	{
		Console.Writeline("This prop's type is Ienumerable");
	}
}

//Note: string is an ienumerable too
Posted by: Guest on July-08-2020

Code answers related to "get property of object list c#"

C# Answers by Framework

Browse Popular Code Answers by Language