Tips and Tricks To Improve Code Readability in C#

1dfad8107453e0f493ff1a6a8e48d503?s=47 Jaime
June 10, 2012

Tips and Tricks To Improve Code Readability in C#

1dfad8107453e0f493ff1a6a8e48d503?s=128

Jaime

June 10, 2012
Tweet

Transcript

  1. 1.

    P2P Code Academy Becoming a C# Warrior-Poet or Tips and

    Tricks To Improve Code Readability in C# 4 30th March
  2. 2.

    C#

  3. 13.

    Extension Methods Add methods to existing types: • No need

    to create derived type • No need to re-compile existing type • No need to modify original type • Just static methods in disguise!
  4. 15.
  5. 19.

    LINQ Query language within C# and VB.NET • Very Expressive

    • Extensible • Integrated – LINQ to Objects – LINQ to SQL – LINQ to XML – LINQ to Entities
  6. 22.
  7. 24.

    If you put it all together... Sonnet 138. The Passionate

    Pilgrim C# version while (myLove.Swears(that: ”She is made of truth”)) { do I.Believe(her); while (she.Lies()) she.Might(s => s.Think(I == ”some untutored youth”)); she.Might(s => s.Think(I == ”unskillful”)); ... }
  8. 25.

    C#

  9. 27.

    References • Object and Collection Initializers http://bit.ly/csharp-object-collection-initializer • Named Arguments

    http://bit.ly/csharp-named-arguments • Extension Methods http://bit.ly/csharp-extension-methods • LINQ http://bit.ly/linq-language-integrated-query
  10. 28.