X? is a shortcut to System.Nullable<X>

In order to use System.Nullable, type X must be a non-nullable type,
which is not guaranteed when declared as

interface IB<X> : IA<X?>
{
}

but when declared as

interface IB<X> : IA<X?> where X : struct
{
}

it should compile.

// Ryan

On Dec 6, 2007 12:29 PM, Mark Nicholls <[EMAIL PROTECTED]> wrote:
> Sorry to bombard with generic questions...
>
> I've just come across
>
> interface IA<X>
> {
> ...
> }
>
> interface IB<X> : IA<X?> // yes the '?' is not a typo
> {
> }
>
> it does compile...it gives
>
> The type 'A' must be a non-nullable value type in order to use it as
> parameter 'T' in the generic type or method 'System.Nullable<T>'
>
> i.e. it understands what the T is....but I don't.
>
> ===================================
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

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

Reply via email to