Should be like that
public void MyMethod<T>()
{
ObservableCollection<T> oc = new ObservableCollection<T>();
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello;
I know type, and I want to create Observable Collection of this type
public void MyMethod(Type T)
{
ObservableCollection<T> oc = new ObservableCollection<T>();
}
or
Type T;
T = MyClass
ObservableCollection<T> oc = new ObservableCollection<T>();
But this code doesnt work, how to do such think?
Should be like that
public void MyMethod<T>()
{
ObservableCollection<T> oc = new ObservableCollection<T>();
}
It is probably imposible.
I discused similiar topic in
https://learn.microsoft.com/en-us/answers/questions/665074/how-to-get-class-from-observablecollection.html