Categories
ASP.NET Software Engineering

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 replies on “Generics in ASP.NET 2.0?”

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.

Sorry.

Leave a Reply to Mikhail Arkhipov (MSFT) Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.