I am litle new with c#.
I need to store data in variable,but I am not sure what is best method for that?
For example if I make object:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public Person(string name, int age)
{
Name = name;
Age = age;
}
//Other properties, methods, events...
}
In code I can define for example
Person person1 = new Person("Leopold", 6);
But what if I have 10000 persons, I must define all of them(person1,person2,etc)? That is not good idea I think. Can I use array or something like that,and how to get that person witch have name Leopold.What is best method to store big collection of data ,and have good access for them. (For example good will be if I could use something like person[somenumber].name or some similar)
Sorry, one more time i am new in this...
Thnx
List<Person> persons List<Person>();and use:persons.Add();