I think something along the lines of

<T : (Bar, Bax), S> would be a reasonable alternative to the "where" clause.

^Tum

> -----Original Message-----
> From: Moderated discussion of advanced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED] On Behalf Of Dominic Cooney
> Sent: Thursday, 23 October 2003 1:27 p.m.
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] C# generics constraints syntax
>
> FWIW, the design of the Java language has gone in the other direction; the
> syntax is: Foo<T extends Bar, U extends Baz>. I am not sure how multiple
> constraints are specified (T extends Bar & Baz, IIRC).
>
> What is VB.NET doing?
>
> Dominic Cooney
>
> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Daniel O'Connell
> Sent: Thursday, 23 October 2003 9:05 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] C# generics constraints syntax
>
> I'd say readability first, personally. It'd be alot easier to read
>
> public class Dictionary<KeyType,ValType> where KeyType : IComparable,
> ICollection, IAnotherThing, ValueType : IComparable, IDictionaryValue,
> IAnotherRestriction
>
> than
> public class Dictionary<KeyType : IComparable, ICollection, IAnotherThing,
> ValueType : IComparable, IDictionaryValue, IAnotherRestriction>;
>
> Beyond that, I imagine parsing is easier this way. It would be tough to
> determine what the second type name is, should it be named ICollection,
> IAnotherThing, ValueType, etc?
>
> ----- Original Message -----
> From: "Thong (Tum) Nguyen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, October 22, 2003 5:50 PM
> Subject: [ADVANCED-DOTNET] C# generics constraints syntax
>
>
> > Hey folks,
> >
> > Can anyone think of a reason why the constraints syntax is this:
> >
> > public class Dictionary<KeyType, ValType> where KeyType : IComparable
> >
> > rather than this:
> >
> > public class Dictionary<KeyType : IComparable, ValType>
> >
> > ?
> >
> > The former adds an additional (unreserved?) keyword to the language and
> > locates two related things apart from each other (the generic parameter
> &
> > its constraint).
> >
> > There's probably a good reason I've overlooked.
> >
> > All the best,
> >
> > ^Tum
> >
> > ===================================
> > This list is hosted by DevelopMentorR  http://www.develop.com
> > NEW! ASP.NET courses you may be interested in:
> >
> > 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> > http://www.develop.com/courses/2daspdotnet
> >
> > Guerrilla ASP.NET, 13 Oct 2003, in Boston
> > http://www.develop.com/courses/gaspdotnet
> >
> > View archives and manage your subscription(s) at
> http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
> NEW! ASP.NET courses you may be interested in:
>
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> http://www.develop.com/courses/2daspdotnet
>
> Guerrilla ASP.NET, 13 Oct 2003, in Boston
> http://www.develop.com/courses/gaspdotnet
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentor.  http://www.develop.com
> NEW! ASP.NET courses you may be interested in:
>
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> http://www.develop.com/courses/2daspdotnet
>
> Guerrilla ASP.NET, 13 Oct 2003, in Boston
> http://www.develop.com/courses/gaspdotnet
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to