Coffeehouse Thread

8 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

The Evolution Of LINQ And Its Impact On The Design Of C#

Back to Forum: Coffeehouse
  • User profile image
    Secret​Software

    hi,
        Wanted to draw your attention to this cool article, that talks about C# and LINQ and how the C# language evolved.

    Exciting times eh?Wink

  • User profile image
    JohnAskew

    Wow, "Object Initializers", that's nice.

    ss's link wrote:

    Object Initializers

    For this case, there is a C# language feature in the upcoming "Orcas" version known as object initializers. Object initializers basically allow the assignment of multiple properties or fields in a single expression. For example, a common pattern for object creation is:

    Customer customer = new Customer();
    customer.Name = “Roger”;
    customer.Address = “1 Wilco Way”;
    

    In this case, there is no constructor of Customer that takes a name and address; however, there are two properties, Name and Address, that can be set once an instance is created. Object initializers allow the same creation with the following syntax:

    Customer customer = new Customer() 
        { Name = “Roger”, Address = “1 Wilco Way” };
    
    
    	
  • User profile image
    harumscarum

    Cool, I can get rid of all of my static create object methods:

    Customer customer = Customer.CreateCustomer(“Roger”,“1 Wilco Way”)



  • User profile image
    Ion Todirel

    Yes cool article. Another cool thing, and i didn't know this until i saw the post about mini-ORM on Christian's blog, is the ability to declare properties like you declare abstract propreties, cool stuff...

  • User profile image
    anand.t

    nice article. Thanks

    btw anyone know if the DVD that they advertise in the site is any useful?? or is everything available online??

    thanks

  • User profile image
    footballism

       Awesome article! you know, initially I cannot buy the idea of var keyword, but after reading this article, everything is designed with a good reason;)

    Sheva

  • User profile image
    Tensor

    harumscarum wrote:
    Cool, I can get rid of all of my static create object methods:

    Customer customer = Customer.CreateCustomer(“Roger”,“1 Wilco Way”)





    Static factory methods like that still have plenty of uses - who knows what other magic is happening in there :O

  • User profile image
    Ray6

    I guess this is one advantage of not having to rely on committees to design your language; you can improve it at a hell of a rate.

    It took a bloody long time to get generics and autoboxing into Java, and they were ever so slightly broken when they arrived unfortunately.


Conversation locked

This conversation has been locked by the site admins. No new comments can be made.