Wield the Power of Generic Type Inference(kodefuguru.com)
submitted by
KodefuGuru(2818) 2 years, 5 months ago
One class that bothers me in the .NET Framework is KeyValuePair<K, V>. To create one these, you must explicitly declare the generic types being used.
var pair = new KeyValuePair<int, string>(42, "The Answer");The .NET Framework support generic type inference, so why did the designer of the KeyValuePair<K, V> class decide it would be good idea to force us to write out the types? Take a look at another type of pair from .NET 4: the 2-valued Tuple.
|category: C#
|Views: 10
tags:
C# another
Everyones tags:
Your Tags: