Tried with :
IList<IList<string>> matrix = new List<new List<string>()>();
but I can’t. How can I do it? I need a matrix of strings…
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.
You’d need:
but then you can happen to always add a
List<string>for each element.The reason this won’t work:
is that it would then be reasonable to write:
… but that would violate the fact that the list is really a
List<List<string>>– it’s got to containList<string>values, not just anyIList<string>… whereas my declaration at the top just creates aList<IList<string>>, so you could add a string array to it without breaking type safety.Of course, you could change to use the concrete type in your declaration instead:
or even: