[Israel.pm] C#3 bits

Mike Freedman michael.freedman at gmail.com
Wed Nov 12 14:58:18 PST 2008


Finally as a c sharp addict, some content I'm actually qualified to
read Hehehehe

On 11/12/08, Shmuel Fomberg <semuelf at 012.net.il> 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... :-)
>
> 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.
> Here again, I don't know what it's good for. one day.
>
> Shmuel.
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>

-- 
Sent from Google Mail for mobile | mobile.google.com



More information about the Perl mailing list