Generics in ASP.NET 2.0?

I’ve finally gotten around to having a closer look at the current Whidbey beta – particularly from the ASP.NET angle. However, I’ve got a fairly straightforward question that so far I haven’t been able to find any answer to – or even the slightest hint of one. Suppose I want to create a custom Web Control, that accepts a type parameter so that, for instance, we can provide a strongly typed DataItem property.

Obviously you can create an instance of this object by doing

this.Controls.Add(new SomeGenericControl<SomeObjectType>());

in the page load event, but at the moment there doesn’t seem to be a way to define this in the aspx page, along the lines of

<vc:SomeGenericControl : SomeObjectType runat=”server” />

or equivalent. Is this something that just hasn’t made the current beta, or is that syntax not going to be included at all?

3 thoughts on “Generics in ASP.NET 2.0?”

  1. I don”t think this will be in Whidbey. At least the VWD editor that my team owns does not support it. You do can declare generic properties and I think property grid supports them to an extent, but markup parser/validator/intellisense engine definitely doesn”t.


Leave a Reply

Your email address will not be published. Required fields are marked *