下面的代碼似乎是不可能編譯的,不管我試圖施展它有多難:P可以somone請告訴我我做錯了什麼?爲什麼不能通過表達式引用類型?
public class LUOverVoltage
{
public string Name { get; set; }
public enum OVType { OVLH, OVLL }
public List<string> PinGroups = new List<string>();
public void Add(string name, OVType type, string Grp)
{
this.Name = name;
this.OVType = type; //Why cannot reference a type through an expression?
PinGroups.Add(Grp);
}
}
你會得到什麼樣的編譯錯誤? – Connell
「OVType」:不能通過表達式引用類型; –