[Mono-dev] misc: C# request info

Jonathan Pryor jonpryor at vt.edu
Tue Feb 24 12:22:06 EST 2009

On Tue, 2009-02-24 at 20:46 +1000, BGB wrote:
> > C# has some tricky syntax too, some tokens change behaviour of following 
> > block. Some are just tricky to parse like generics, nullables, lambdas, 
> > etc.
> >
> > Here is one example
> >
> > Foo (x <y, z> (0));
> >
> AFAIK the above can't be a generic since a generic can't appear in this 
> context (I will assume this being an expression...).

Behold the proof that it works:

	public static bool x<T1, T2>(int n) {return n != 0;}

If you have types y and z in scope, and a method Foo(bool), then the
call Foo(x<y,z>(0)) is in fact, valid, calling the method Foo() with the
result of the generic method call x<y,z>(0).

> (funcall Foo (< x y) (> z 0))
> unless generics can appear in a expression context, which AFAIK they can't.

In fact, they can, as demonstrated above.  Don't forget about generic
methods. :-)

 - Jon

More information about the Mono-devel-list mailing list