None

None

  • NA
  • 2
  • 0

Is it possible to instantiate a parameterized Generic

Jun 19 2008 8:50 AM
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)