All notes

Windows Coding Conventions

Why we need coding conventions?

Layout conventions:

Language guidelines:

LINQ Queries

// Use meaningful names.
var seattleCustomers = from cust in customers
                       where cust.City == "Seattle"
                       select cust.Name;

// Use aliases to make sure that property names of anonymous types are in Pascal casing.
var localDistributors =
    from customer in customers
    join distributor in distributors on customer.City equals distributor.City
    select new { Customer = customer, Distributor = distributor };

// Align query clauses under the from clause, as shown in the previous examples.

// Use where clauses before other query clauses to ensure that later query clauses operate on the reduced, filtered set of data.
var seattleCustomers2 = from cust in customers
                        where cust.City == "Seattle"
                        orderby cust.Name
                        select cust;

// Use a compound from to access the inner sequence within each element, instead of a join clause.
var scoreQuery = from student in students
                 from score in student.Scores
                 where score > 90
                 select new { Last = student.LastName, score };