Answers for "creating list of objects in c#"

C#
2

c# initialize list of objects

List<Cat> moreCats = new List<Cat>
{
    new Cat{ Name = "Furrytail", Age=5 },
    new Cat{ Name = "Peaches", Age=4 },
    null
};
Posted by: Guest on August-21-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

Code answers related to "creating list of objects in c#"

C# Answers by Framework

Browse Popular Code Answers by Language