日期:2014-05-17 浏览次数:20899 次
static void Main(string[] args) { ConsoleTest.goods mode=new ConsoleTest.goods(); testReference<ConsoleTest.goods>(out mode); Console.WriteLine(mode.Barcode); Console.ReadKey(); } private static void testReference<T>(out T model) where T : new() { model = new T(); ConsoleTest.goods good = (model as ConsoleTest.goods); testReference2<ConsoleTest.goods>(out good); } private static void testReference2<T>(out T model) where T : new() { model = new T(); ConsoleTest.goods good = model as ConsoleTest.goods; good.Barcode = "111"; }
private static void testReference<T>(out T model) where T : new() { model = new T(); //ConsoleTest.goods good = model as ConsoleTest.goods; testReference2<T>(out model); }