|
|
|
|
|
by Pxtl
4419 days ago
|
|
They are doing a hack for top-level functions - they're adding "using" for static classes so you can pull all the static methods of a class into the local namespace. Don't see how that would help for dictionaries, though. The ugly part of the dictionary is the type parameters, but I can't see a workaround for that without some really hard type-inferencing for all generics. I mean, you'd have to infer the type-parameters of a generic class based on the type-parameter of the IEnumerable passed into its constructor (dictionary takes an IEnumerable of KeyValuePairs of TKey, TValue). That's a little messy. |
|
More likely, they'll graft in yet another special rule in the compiler (not accessible to user code!), just as they did with other collections, foreach, async, etc. I find it ugly that the compiler is happy to use static duck typing when convenient, but such a feature isn't exposed in the language.