I've got following struct and I need to create an instance of it through System.Reflection . The big issue is that I have a generic and a non generic parameter. I have to use System.Reflection because it'll be called in a loop where T can vary. I've looked at this , but I was unabled to get it work with the second parameter (int tag). I'm sorry that I have to ask this basic question.
struct pair<T>
{
public pair(T value,int tag)
{...}
}
so I would need the magic in this:
object createPair(object o,int tag)
{
return *somemagic*
}
EDIT: the solution was making the struct public in combination with the first answer. If a struct is nested in a generic struct, both answers throw an ArgumentException, independent of the input. I'm sorry for not knowing this affect of nesting.