Answer the question
In order to leave comments, you need to log in
How to get and insert a type argument into a generic?
I want to insert T into a function with a generalization (for example, ToPlace(.....) ). In the function where I call ToPlace<>(), I do not pass the type. so I want to get it from the array
I'm trying like this:
Type t = mas[0]; //где массив типа Sysetm Type
ToPlace<t>(.....); //пишет: "t" является переменная, но используется как тип
Answer the question
In order to leave comments, you need to log in
No way. Cast all objects to object and sort through reflection at runtime.
Along the way, you can add an overload for the ToPlace(..., Type type) method
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question