Initializing a List c#
Posted
by
Mohan
on Stack Overflow
See other posts from Stack Overflow
or by Mohan
Published on 2010-12-25T05:45:29Z
Indexed on
2010/12/25
5:54 UTC
Read the original article
Hit count: 478
c#
List<Student> liStudent = new List<Student>
{
new Student
{
Name="Mohan",ID=1
},
new Student
{
Name="Ravi",ID=2
}
};
public class Student
{
public string Name { get; set; }
public int ID { get; set; }
}
Is there other way to write this? I am a newbie. I want to make instance of student class first and assign properties in list.
© Stack Overflow or respective owner