DIP6: Attributes

Sergey Gromov snake.scaly at gmail.com
Tue Aug 4 05:34:12 PDT 2009


Tue, 04 Aug 2009 17:22:50 +1000, Daniel Keep wrote:

> Don wrote:
>> ...
>> 
>> A question: in C#/Java, can you have annotations on function pointer and
>> delegate declarations?
>> 
>> void foo( int delegate(int) pure dg) {
>>   ...
>> }
>> What would this look like with annotations?
> 
> Well, Java doesn't HAVE delegates and C# doesn't (AFAIK) allow you to
> define them inline; they have a special declaration syntax that can't be
> used in an expression.

C#:

List<int> ls;
ls.Sort((x, y) => y - x);

or

ls.Sort((x, y) => { int a; a = y; a -= x; return a; });



More information about the Digitalmars-d mailing list