Re: Generics passing Class type
- From: "Marc Gravell" <marc.gravell@xxxxxxxxx>
- Date: 17 Aug 2006 22:02:47 -0700
So no, this (generic inheritance) is illegal:
class MyEditingControl<T> : T, IDataGridViewEditingControl
{ ... }
However you could do this:
class MyEditingControl<T> : IDataGridViewEditingControl where T :
Control
{
private T Control; // either pass in via ctor, or declare T: new()
and create
}
i.e. you can *contain* a T which you can then display in the UI, and
manipulate (using only, by default, the properties on the known
base-class, i.e. those of Control in this case.
Marc
.
- Prev by Date: Re: TreeNode.ShowCheckBox
- Next by Date: Re: Event Handler 00026986945
- Previous by thread: C# Client PC office version
- Next by thread: Re: Generics passing Class type
- Index(es):