List<Foo> bar= new List<Foo>()
{
new Foo(){ name= "xxx", sname= "yyy", age= 22 },
new Foo(){ name= "zzz", sname= "ccc", age= 18 },
new Foo(){ name= "aaa", sname= "bbb", age= 14 },
new Foo(){ name= "ddd", sname= "fff", age= 26 },
new Foo(){ name= "uuu", sname= "hhh", age= 17 },
};
I want to get the name, surname, age from a database table.
How can I match the values with this list?
I want to get the data; Select name From FooBar Where Id = 4 assume that the return value is John and then I want to assign the John to name property of
List<Foo> bar= new List<Foo>
and the question is how can I do this with ADO.NET?
I’m not exactly sure of what you’re asking, but I’ll go on the assumption that you might be looking to query a list of data that was returned from the database.
You can use this code to query the list: