I have a class with a static method:
public class MyClass {
public static bool MyMethod<T>(string arg1) where T : class {
// ...
}
}
How can I invoke that given that I know my type for T
should be MyNamespace.Data.Models.Student
(which is provided via a variable), and the value for arg1
is let's say student
.
Is it similar to the following? I'm not sure how to set the T
type for it tho.
Type.GetType("MyClass").GetMethod("MyMethod").Invoke(null, new object[] { arg1 = "student" })