-
-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for List construction with values #194
Comments
Relevant C# documentation: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers#collection-initializers
is equivalent to: List<int> list = new List<int>();
list.Add (1);
list.Add (2);
list.Add (3); If the wanted var moreNumbers = new Dictionary<int, string>
{
{19, "nineteen" },
{23, "twenty-three" },
{42, "forty-two" }
}; is equivalent to: var moreNumbers = new Dictionary<int, string>();
moreNumbers .Add(19, "nineteen");
moreNumbers .Add(23, "twenty-three");
moreNumbers .Add(42, "forty-two"); I also learned that you can use indexers!! var numbers = new Dictionary<int, string>
{
[7] = "seven",
[9] = "nine",
[13] = "thirteen"
}; To be complete, we should probably also allow the creation of an
|
Supporting array initializer would be great as well @davideicardi @metoule Any advice on how to add this feature? |
Closed by #250 ! Thank you @holdenmai and @metoule ! |
Would be possible to support syntax like this?....
new List<int>() { 1, 2, 3 }
The text was updated successfully, but these errors were encountered: