I have a class:
public abstract class Criteria
{
public virtual Enum Field
{
get; set;
}
public string FieldData;
}
I have an enum:
public enum MyFieldsEnum
{
Name=1,
Age=2,
Gender=3,
}
I have an inherited class:
public class MyCriteria : Criteria
{
MyFieldsEnum myfields;
public override MyFieldsEnum Field
{
get
{
return myfields;
}
set
{
base.Field = value;
}
}
}
The idea is to return the MyFieldsEnum rather than the blank Enum Field. But the above code does not work and does not accept MyFieldsEnum for Field. It gives the error: "Type must be enum to match overridden member Criteria.Field"
Is it possible in some way or the other?