We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We can initialize generics with initial data, but we still have to specify type of the generic. It would be nice to omit type defenition in that case.
Currently following statements are legal.
int[] array = { 1, 2, 3 }; var array = new[] { 1, 2, 3 }; var list = new List<int> { 1, 2, 3 }; var dictionary = new Dictionary<string, string> { ["key"] = "value" };
With syntax proposed in this topic you'd be able to write:
var list = new List { 1, 2, 3 }; // List<int> var dictionary = new Dictionary { ["key"] = "value" }; // Dictionary<string,string>
It is simmilar to how type omit works for Generic Methods.
omit
Generic Methods
... public static T GetData<T>(T data) => data; ... // type is omited in this case var data = GetData(1);
Relates to #5865 issue.
The text was updated successfully, but these errors were encountered:
belongs to https://github.com/dotnet/csharplang/, please move this
Sorry, something went wrong.
Sure, will open there and colse this one. Thank you.
No branches or pull requests
We can initialize generics with initial data, but we still have to specify type of the generic. It would be nice to omit type defenition in that case.
Currently following statements are legal.
With syntax proposed in this topic you'd be able to write:
It is simmilar to how type
omit
works forGeneric Methods
.Relates to #5865 issue.
The text was updated successfully, but these errors were encountered: