I have something like this
public void FunctionName<T>(){
}
and to call this you need something like this
sub main(){
FunctionName<Integer>();
}
my question is can i pass the Integer as "Integer"?
sub main(){
FunctionName<"Integer">();
}
or is there any other way to that
Ok here is my actual code
private static T Convert<T>(DataRow row) where T : new()
{
T model = new T();
Type modelType = model.GetType();
FieldInfo[] fields = null;
FieldInfo field = default(FieldInfo);
Type fieldType = null;
string fieldName = null;
fields = modelType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
foreach ( field in fields) {
fieldType = field.FieldType;
fieldName = field.Name.Replace("_", string.Empty);
Interaction.CallByName(model, fieldName, Microsoft.VisualBasic.CallType.Set, GetValue(row, fieldName, fieldType.Name));
}
return model;
}
static void main(){
Student s;
s = Convert<Student>(DatabaseRow);
}
The problem here is I just can only get the Student as string ("Student") from somewhere that will use this code Any other solution to get this right?