I have a class like this:
public class ItemField
{
public string FieldName { get; set; }
public object FieldValue
{
get;
set;
}
}
I want to have it so that "FieldValue" can only be of type string, MyItem, or List<MyItem>. I also want it so that when code consumes this class, accessing "FieldValue" returns the right type of object. Is there a way to do this? I'm not too clear on generics, but there seems to be a way to do this using that.
Sumit Kesarwani
28-Aug-2014