Type.GetGenericArguments and MethodInfo.GetGenericArguments
using System;
class MyClass<K, V> {
public void FunctionA(K argk, V argv) {
}
}
class Starter {
public static void Main() {
MyClass<int, decimal> obj = new MyClass<int, decimal>();
MyClass<string, float> obj2 = new MyClass<string, float>();
Type closedType = obj.GetType();
Type openType = closedType.GetGenericTypeDefinition();
Type closedType2 = obj2.GetType();
Type openType2 = closedType2.GetGenericTypeDefinition();
Console.WriteLine(openType.ToString());
Console.WriteLine(openType2.ToString());
}
}