Re: Valid constraints.
- From: Barry Kelly <barry.j.kelly@xxxxxxxxx>
- Date: Sat, 13 Jan 2007 12:48:33 +0000
Kevin Burton wrote:
I have an interface that I am trying to make the generic constraints as
restictive as possible so that the generic types are not what is expected. I
get two errors:
1) Indicates that the contraint type cannot be sealed. How can I get around
this?
Why would you want to? E.g.:
sealed class S {}
class C<T> where T : S {}
.... in this case, C<> can only ever be instantiated with S, since
nothing can derive from S. So what's the point in it being generic then?
2) I get an error that a particular type must come before other constraints.
I am not sure how to order the constraints. I was not even aware from the
documentation that there was a order restriction on the constraints.
Can you show an example?
-- Barry
--
http://barrkel.blogspot.com/
.
- Follow-Ups:
- Re: Valid constraints.
- From: Kevin Burton
- Re: Valid constraints.
- Prev by Date: Re: local path
- Next by Date: UML class library needed
- Previous by thread: Re: local path
- Next by thread: Re: Valid constraints.
- Index(es):
Loading