I have classes as below:
public class SampleClassToTest<T> { public static Fake<T> SomeMethod(string parameter) { // some code } public static Fake<T> SomeMethod(string parameter, int anotherParameter) { //some another code } } public class Fake<T> { // some code }
And I want to use them as follows:
SampleClassToTest<MyClass>.SomeMethod("some parameter");
The problem I have is this: the type is "MyClass", which I can only get from the PropertyInfo instance using Reflection, so I have
Type propertyType = propertyInfo.PropertyType;
How can i do this? Any ideas?
UPD I am trying to pass a type to a generic method. And yes, that is what I want.
source share