I want to be able do something like this
void SampleFunction(Type type)
{
type varA = default(type);
OtherGenericFunction<type>();
}
Tried using typeof(type)
but it didn't gave any result.
I tried searching it, but did not understand solutions or how to apply them, these I looked:
How to use local variable as a type?
Passing just a type as a parameter in C#
Can someone explain how to deal with situation in my case?
Just to give some context: I trying to mock some generic functions. As straightforward mock of generic doesn't working - my current theoretical solution is to gather List<Type>
of used types in function Im testing, then just iterate through it and setup my mock object.