The following code seems to be impossible to compile no matter how hard I am trying to cast it 😛 can somone please tell me what I am doing wrong?
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);
}
}
You’re confusing a field that has an enum type with the enum type itself. Your code is about as useful as saying
string="bla".This declares a type called
OVTypeand a property with the same name. Now your code should work.As a side note, both your type names, and the property names violate .net naming guidelines.
I’d name the enum type
OverVoltKindand the property justKind.