I want to create a List like this :
List<int, DateTime> foo = new List<int, DateTime>();
but I get this error :
Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments
Is it possible to do that in C# ?
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.
It depends on what you want to do.
You can for example use a Dictionary if you want to use int as an index to access a DateTime like this:
Or if you want to store an arbitrary list of values and allow duplicates you can use: