摘要:(200-08-02) C#.NET Generic Class 定義泛型類別
定義泛型類別
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mod01
{
public class MyEmployee<T>
{
private T _myEmployee;
public T MyEmployee1
{
get { return _myEmployee; }
set { _myEmployee = value; }
}
}
}主程式
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mod01
{
class TestGenericClass
{
public static void Main()
{
MyEmployee<Employee> emp = new MyEmployee<Employee>();
System.Console.WriteLine(emp.GetType().ToString());
}
}
}