views:

451

answers:

1

How can I do the following in C#? What is the right way to write the first line of this code snippet?

using KVP<K, V> = System.Collections.Generic.KeyValuePair<K, V>;

class C { KVP<int, string> x; }
+18  A: 

You can't, basically. You can only use fixed aliases, such as:

using Foo = System.Collections.Generic.KeyValuePair<int, string>;

class C { Foo x; }
Marc Gravell