Hi:
How can I pass to the class below, the name of the class type in order to assume the string type passed, in the class methods:
For example
I have the following classes:
---------------
public class Class1 : System.Collections.CollectionBase
{
public Class1(string class_type_str)
{
}
public "class_type_str" this[int index]
{
get
{
//** Retorna valor
return ("class_type_str")this.List[index];
}
set
{
//** Almacena valor
this.List[index] = value;
}
}
public void Add("class_type_str" source)
{
this.List.Add(source);
}
}
public class Class2
{
public string Code;
public string Name;
}
public class Class3
{
public string Code;
public string Name1;
public string Name2;
}
----------------
I would like to do something like this:
Class1 obj = new Class1("Class2"); or Class1 obj = new Class1("Class3");
and the Indexers and the Add method use instance of Class2 or Class3.
Thanks
How can I pass to the class below, the name of the class type in order to assume the string type passed, in the class methods:
For example
I have the following classes:
---------------
public class Class1 : System.Collections.CollectionBase
{
public Class1(string class_type_str)
{
}
public "class_type_str" this[int index]
{
get
{
//** Retorna valor
return ("class_type_str")this.List[index];
}
set
{
//** Almacena valor
this.List[index] = value;
}
}
public void Add("class_type_str" source)
{
this.List.Add(source);
}
}
public class Class2
{
public string Code;
public string Name;
}
public class Class3
{
public string Code;
public string Name1;
public string Name2;
}
----------------
I would like to do something like this:
Class1 obj = new Class1("Class2"); or Class1 obj = new Class1("Class3");
and the Indexers and the Add method use instance of Class2 or Class3.
Thanks