------------------------------------StaticDome.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { public class StaticDome<T> { public static int x; } }
------------------------------------主程序
StaticDome<int>.x = 4; StaticDome<string>.x = 5; Console.WriteLine(StaticDome<int>.x);//输出4 Console.WriteLine(StaticDome<string>.x);//输出5 Console.ReadKey();
本文出自 “程序猿的家” 博客,请务必保留此出处http://962410314.blog.51cto.com/7563109/1438155
原文地址:http://962410314.blog.51cto.com/7563109/1438155