How can i select name in list? which is itself in list???
My struct:
public class Item
{
int id;
List<Name> names;
}
public class Name
{
int id;
string name;
}
List<Item> Items;
code:
Items.Select(a => a.id = 1) //whats next
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you want all of the names in a list, you can do:
Or if you want a list of the string names from the list, you can do:
Then, if you’re using my second statement, you can output a list in the format
item, item, itemby doing:EDIT: As requested in comments, here’s how you can get names by ID based on the Name ID:
EDIT 2: To display name items and items that both have an ID of 1, try this: