Answers for "list with class in c#"

C#
0

c# get list object type of generic list

Type type = pi.PropertyType;
if(type.IsGenericType && type.GetGenericTypeDefinition()
        == typeof(List<>))
{
    Type itemType = type.GetGenericArguments()[0]; // use this...
}
Posted by: Guest on October-15-2020
0

List example in c# using class objects

var students = new List<Student>() { 
                new Student(){ Id = 1, Name="Bill"},
                new Student(){ Id = 2, Name="Steve"},
                new Student(){ Id = 3, Name="Ram"},
                new Student(){ Id = 4, Name="Abdul"}
            };
Posted by: Guest on October-17-2021

C# Answers by Framework

Browse Popular Code Answers by Language