class StaticConstructors
{
class Outer<T>
{
public class Inner<U, V>
{
static Inner()
{
Console.WriteLine("Outer<{0}>.Inner<{1},{2}>",
typeof(T).Name,
typeof(U).Name,
typeof(V).Name);
}
public static void DummyMethod()
{
}
}
}
static void Main()
{
Outer<int>.Inner<string, DateTime>.DummyMethod();
Outer<string>.Inner<int, int>.DummyMethod();
Outer<object>.Inner<string, object>.DummyMethod();
Outer<string>.Inner<string, object>.DummyMethod();
Outer<object>.Inner<object, string>.DummyMethod();
深入理解 c# 第三章 嵌套泛型类型的静态构造函数
最新推荐文章于 2024-04-21 20:19:20 发布