1
Answer

Is it possible to instantiate a parameterized Generic

None

None

16y
2.8k
1
Hi,

I was wondering if it possible to instantiate a parameterized Generic eg

public T GetListViewData<T>() where T : AbstractOrganizationalUnit, new()
        {
            return new T(this.OrganizationalUnitId, DateTime.Now));
        }

first I tried it having the AbstractOrganizationalUnit-class abstract. Then I modified it to public. AbstractOrganizationalUnit has a constructor which actually takes this signature and so do all child classes of AbstractOrganizationalUnit.

Any idea how to approach that???

thanks in advance antoschka
Answers (1)