Let\'s say I have an object that represents a field of data, that object needs the following properties: Name, Type, Value, Length. Here is the object:
class
I suggest you to define an interface and Field
implements that interface
public interface IField
{
}
public class Field : IField
{
public string Name { get; set; }
public Type Type
{
get
{
return typeof(T);
}
}
public int Length { get; set; }
public T Value { get; set; }
}
so you can write this code:
var list = new List();
now this list can contain any object of type Field