I would like to create a list of objects in which there is a generic list.
So what I have is this object:
public class agieDBColumn<dataTp> where dataTp:IComparable{
private string _header;
private string _longHeaderName;
private List<dataTp> _data;
public string header {
get { return _header; }
set { _header = value; }
}
public string longHeaderName {
get { return _longHeaderName; }
set { _longHeaderName = value; }
}
public List<dataTp> data {
get { return _data; }
set { _data = value; }
}
}
And this is how I would like to use it:
List<DBColumn> columns;
Then I would like to add new instances to the list “columns” specifying the type.
There does not seem to be a syntaxs that allows this though as I get “Error 1 Using the generic type Picker.DBColumn<dataTp> requires 1 type arguments Frm.cs 56 9 FCAgieStratPicker
” when trying to define the type of List I would like.
Is this even possible? Or would I need to use the base class object in this case?
Maybe there is a better way to handle the data I would like to represent in memory.
It seems what you eventually want to achieve is already provided by the
System.Data.DataTableclass.Adding columns:
Adding rows: