Is it possible to somehow transfer the type to a method?
public void блабла( object type) { list<type> NewList = new list<type>() ; }
Something like that?
Is it possible to somehow transfer the type to a method?
public void блабла( object type) { list<type> NewList = new list<type>() ; }
Something like that?
public void блабла<T>() { List<T> NewList = new List<T>() ; }
In general, every object has an Object.GetType () method that returns the type of this object.
But try to use strong typing, namely to accept a specific type in methods, and not object.
Use the full power of templates .
Source: https://ru.stackoverflow.com/questions/11874/
All Articles