Answer the question
In order to leave comments, you need to log in
How to get a class object from a list by the value of one of the variables?
Hello! There is a list of class objects and the class itself:
class Program
{
static void Main(string[] args)
{
List<Test> TestList = new List<Test> {
new Test(1,2),
new Test(1,1),
new Test (1,3),
new Test(1,6)
};
}
}
class Test
{
private int Var1, Var2;
public Test(int _var1,int _var2)
{
Var1 = _var1;
Var2 = _var2;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question