Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は多くのtypeparamsを持つクラスを宣言します:
public class A<T1, T2, T3, T4, T5> {}
このようなエイリアスを使用するにはどうすればよいですか?
public class B<T1, T2, T3, T4, T5> { using T = A<T1, T2, T3, T4, T5> public void Method() { T.StaticMethod(); } }
これは、残りのusingステートメントで実行できます。
using MyList = System.Collections.Generic.Dictionary<int, string>;
次に、次のようにクラスを使用できます。
MyList x = new MyList(); x.Add(0, "Hello World");
しかし、これはちょっと悪いデザインです。あなたが投稿した例では、Bにはまだ5つのジェネリック型引数があるため、何も得られません。