Call a generic method and set the generic type at runtime

In the example bellow, is it possible to set the Classname type parameter dynamically?

UpdateAndSave<Classname>>().Execute(sql)
Jon Skeet
people
quotationmark

Well you can call it by reflection, yes - using MethodInfo.MakeGenericMethod to provide the type arguments:

var method = typeof(Whatever).GetMethod("UpdateAndSave");
var genericMethod = method.MakeGenericMethod(typeArgument);
genericMethod.Invoke(target, new object[] { sql });

people

See more on this question at Stackoverflow