Does anyone else get the same behaviour, I'm not short of a service pack
or something am I?

> -----Original Message-----
> From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED] On Behalf Of Nicholls, Mark
> Sent: 28 February 2008 15:57
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] extensions methods and type
inference....
> 
> Nope that's not it because there is a simpler example...
> 
> 
>     static class Program
>     {
>         [STAThread]
>         static void Main()
>         {
>             B<IA> t = new B<IA>();
>             t.Test();                           // #1
>             t.Test<IA, B<IA>>();                // #2
>         }
>     }
> 
> 
>     public interface IA
>     {
>     }
> 
> 
>     public class B<T>
>         where T : IA
>     {
>     }
> 
> 
>     public static class Extension
>     {
>         static public void Test<A,B>(this B b)
>             where B : B<A>
>             where A : IA
>         {
>         }
>     }
> 
> #1 does not compile
> #2 does...yet I cannot see that there is any other solution except the
> only explicitly specified....it looks like the type inference does not
> like something....I expect it's the
> 
>             where B : B<A>
>             where A : IA
> 
> bit.
> 
> > -----Original Message-----
> > From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> > [EMAIL PROTECTED] On Behalf Of Nicholls, Mark
> > Sent: 28 February 2008 15:46
> > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > Subject: Re: [ADVANCED-DOTNET] extensions methods and type
> inference....
> >
> > The clue may be that both...
> >
> >             t.Test<IA, B<IA>>();
> >             t.Test<IA, IB<IA>>();
> >
> > and compile, thus there are multiple solutions....even so it should
be
> > asking me to clarify by passing type parameters, not claiming no
such
> > parameters exist.
> >
> > > -----Original Message-----
> > > From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> > > [EMAIL PROTECTED] On Behalf Of Nicholls, Mark
> > > Sent: 28 February 2008 15:39
> > > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > > Subject: Re: [ADVANCED-DOTNET] extensions methods and type
> > inference....
> > >
> > > Ok here's a simple example....
> > >
> > >
> > >     public interface IA
> > >     {
> > >     }
> > >
> > >     public interface IB<T>
> > >         where T : IA
> > >     {
> > >     }
> > >
> > >     public class B<T> : IB<T>
> > >         where T : IA
> > >     {
> > >     }
> > >
> > >
> > >     public static class Extension
> > >     {
> > >         static public void Test<A,B>(this B b)
> > >             where B : IB<A>
> > >             where A : IA
> > >         {
> > >         }
> > >     }
> > >
> > >
> > > static void Main()
> > >         {
> > >         B<IA> t = new B<IA>();
> > >         t.Test();    // #1
> > >         t.Test<IA, B<IA>>(); // #2
> > > }
> > >
> > > #2 compiles...
> > > #1 complains.
> > >
> > > "Error  1
> > > 'WindowsFormsApplication3.B<WindowsFormsApplication3.IA>' does not
> > > contain a definition for 'Test' and no extension method 'Test'
> > accepting
> > > a first argument of type
> > > 'WindowsFormsApplication3.B<WindowsFormsApplication3.IA>' could be
> > found
> > > (are you missing a using directive or an assembly reference?)
> > > C:\Documents and Settings\nichom\My Documents\Visual Studio
> > >
> >
>
2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Program.
> > > cs      17      13      WindowsFormsApplication3"
> > >
> > > Yet clearly #2 proves the error to be incorrect...there is a
> > solution...
> > >
> > >
> > >
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> > > > [EMAIL PROTECTED] On Behalf Of Per Bolmstedt
> > > > Sent: 28 February 2008 13:55
> > > > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > > > Subject: Re: [ADVANCED-DOTNET] extensions methods and type
> > > inference....
> > > >
> > > > On Thu, 28 Feb 2008 08:50:19 -0500, Mark Nicholls
> > > > <[EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > but I can actually explicitly define the types e.g.
> > > > > x.BLA<int,object>(foo,bar);
> > > > > and the compiler will happily accept it...and run it.
> > > >
> > > > Surely x is an instance here, not a type? Could you post actual
> > code?
> > > >
> > > > ===================================
> > > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > > >
> > > > View archives and manage your subscription(s) at
> > > > http://discuss.develop.com
> > >
> > >
> > >
> > > CONFIDENTIALITY NOTICE
> > >
> > > This e-mail (and any attached files) is confidential and protected
> by
> > > copyright (and other intellectual property rights). If you are not
> the
> > > intended recipient please e-mail the sender and then delete the
> email
> > and
> > > any attached files immediately. Any further use or dissemination
is
> > > prohibited.
> > >
> > > While MTV Networks Europe has taken steps to ensure that this
email
> > and
> > > any attachments are virus free, it is your responsibility to
ensure
> > that
> > > this message and any attachments are virus free and do not affect
> your
> > > systems / data.
> > >
> > > Communicating by email is not 100% secure and carries risks such
as
> > delay,
> > > data corruption, non-delivery, wrongful interception and
> unauthorised
> > > amendment. If you communicate with us by e-mail, you acknowledge
and
> > > assume these risks, and you agree to take appropriate measures to
> > minimise
> > > these risks when e-mailing us.
> > >
> > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse,
> > > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions
> > > International and Comedy Central are all trading names of MTV
> Networks
> > > Europe.  MTV Networks Europe is a partnership between MTV Networks
> > Europe
> > > Inc. and Viacom Networks Europe Inc.  Address for service in Great
> > Britain
> > > is UK House, 180 Oxford Street, London W1D 1DS, UK.
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s) at
> > > http://discuss.develop.com
> >
> >
> >
> > CONFIDENTIALITY NOTICE
> >
> > This e-mail (and any attached files) is confidential and protected
by
> > copyright (and other intellectual property rights). If you are not
the
> > intended recipient please e-mail the sender and then delete the
email
> and
> > any attached files immediately. Any further use or dissemination is
> > prohibited.
> >
> > While MTV Networks Europe has taken steps to ensure that this email
> and
> > any attachments are virus free, it is your responsibility to ensure
> that
> > this message and any attachments are virus free and do not affect
your
> > systems / data.
> >
> > Communicating by email is not 100% secure and carries risks such as
> delay,
> > data corruption, non-delivery, wrongful interception and
unauthorised
> > amendment. If you communicate with us by e-mail, you acknowledge and
> > assume these risks, and you agree to take appropriate measures to
> minimise
> > these risks when e-mailing us.
> >
> > MTV Networks International, MTV Networks UK & Ireland, Greenhouse,
> > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions
> > International and Comedy Central are all trading names of MTV
Networks
> > Europe.  MTV Networks Europe is a partnership between MTV Networks
> Europe
> > Inc. and Viacom Networks Europe Inc.  Address for service in Great
> Britain
> > is UK House, 180 Oxford Street, London W1D 1DS, UK.
> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> 
> 
> 
> CONFIDENTIALITY NOTICE
> 
> This e-mail (and any attached files) is confidential and protected by
> copyright (and other intellectual property rights). If you are not the
> intended recipient please e-mail the sender and then delete the email
and
> any attached files immediately. Any further use or dissemination is
> prohibited.
> 
> While MTV Networks Europe has taken steps to ensure that this email
and
> any attachments are virus free, it is your responsibility to ensure
that
> this message and any attachments are virus free and do not affect your
> systems / data.
> 
> Communicating by email is not 100% secure and carries risks such as
delay,
> data corruption, non-delivery, wrongful interception and unauthorised
> amendment. If you communicate with us by e-mail, you acknowledge and
> assume these risks, and you agree to take appropriate measures to
minimise
> these risks when e-mailing us.
> 
> MTV Networks International, MTV Networks UK & Ireland, Greenhouse,
> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions
> International and Comedy Central are all trading names of MTV Networks
> Europe.  MTV Networks Europe is a partnership between MTV Networks
Europe
> Inc. and Viacom Networks Europe Inc.  Address for service in Great
Britain
> is UK House, 180 Oxford Street, London W1D 1DS, UK.
> 
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
> 
> View archives and manage your subscription(s) at
> http://discuss.develop.com



CONFIDENTIALITY NOTICE

This e-mail (and any attached files) is confidential and protected by 
copyright (and other intellectual property rights). If you are not the 
intended recipient please e-mail the sender and then delete the email and 
any attached files immediately. Any further use or dissemination is 
prohibited.

While MTV Networks Europe has taken steps to ensure that this email and 
any attachments are virus free, it is your responsibility to ensure that 
this message and any attachments are virus free and do not affect your 
systems / data.

Communicating by email is not 100% secure and carries risks such as delay, 
data corruption, non-delivery, wrongful interception and unauthorised 
amendment. If you communicate with us by e-mail, you acknowledge and 
assume these risks, and you agree to take appropriate measures to minimise 
these risks when e-mailing us. 

MTV Networks International, MTV Networks UK & Ireland, Greenhouse, 
Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions 
International and Comedy Central are all trading names of MTV Networks 
Europe.  MTV Networks Europe is a partnership between MTV Networks Europe 
Inc. and Viacom Networks Europe Inc.  Address for service in Great Britain 
is UK House, 180 Oxford Street, London W1D 1DS, UK.

===================================
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