[Israel.pm] C#3 bits

Shlomi Fish shlomif at iglu.org.il
Thu Nov 13 00:03:12 PST 2008

Hi Shmuel!

On Thursday 13 November 2008, Shmuel Fomberg wrote:
> Hi All.
> I've been looking on C#3, and they have lambda expressions now! meaning,
> when you write:
> c => c + 1
> you actually define an anonymous function that takes one parameter (c)
> and return c+1. The type of "c" is decided by the context of the lambda
> expression definition.
> The aren't closures. Man, Perl made me greedy... :-)

Can you also define more than one expression in the right side of this lambda? 
Or is it like Python, where you are limited to one expression?

> They also have anonymous classes. writing:
> var p1 = new { Name = "Shovel", Price = 495.0 };
> Will create an anonymous class. I still don't know what it's good for,
> because as much as I seen, the fields of this class can not be accessed
> without reflection.
> It is possible to declare a variable as "var", like this:
> var x = new Customer();
> And x will automatically be of type Customer. cute.
> And one last, there are Extension functions. if declared:
> public static class E
> {
>     public static void F(this object obj, int i) { }
>     public static void F(this object obj, string s) { }
> }
> then every instance of any type, it is possible to class:
> a.F(5);
> and "a" will attached to "obj", i=5.

I don't understand that feature from your description. I think I understood 
the two or three previous ones.


	Shlomi Fish

Shlomi Fish       http://www.shlomifish.org/
The Case for File Swapping - http://xrl.us/bjn7i

Shlomi, so what are you working on? Working on a new wiki about unit testing 
fortunes in freecell? -- Ran Eilam

More information about the Perl mailing list