Friday, August 17, 2007

Monday, July 16, 2007

Wednesday, June 27, 2007

C# 3.0 features

New Language Features for C# 3.0

  • var keyword - Declares a variables that will be created as the type that it is set to. This is particularly useful for LINQ, but it can also be used in foreach...

foreach(var cus in customers) // cus is strongly typed as a Customer type.

  • Object initializers - Allows you to initialize an object by setting properties.

var cus = new Customer() { Name = "Boeing" };

  • Collection initializers - Similar to object initializers, but used to load a collection. Any Add method exposed by the the collection can be used to define the initializer. This allows you to add elements to lists as well as dictionaries or any custom Add method that you create.
  • Auto-implemented properties - Allows you to define a property without having to define the field or the get and/or set. The code is inferred by the property.

public string Name { get; set;}  // this is expanded by the compiler to be a standard property with corresponding field

  • Anonymous types - Allows LINQ to automatically create a type when transforming data. The type is not directly available from code, but you still get Intellisense to help you use the object.
  • Lambda expressions (=> operator) - This is basically a lightweight version of anonymous methods. A lambda expression can be passed as a parameter to another method, just define a delegate that matches the lambda expression.
  • Extension methods - Allows a type to "attach" methods to another type. To do this, add the this keyword in front of the first parameter in a static method.

public static string DoSomething(this string s) // This can be called like this - var something = "Hi".DoSomething()

  • Partial Methods - I didn't quite catch how this works, but it seems like it allows designer generated code to define a method that you can implement.

 

REST - An Architectural Style, Not a Standard

REST is an acronym standing for Representational State Transfer.

Description: A representation of the resource is returned (e.g., Boeing747.html). The representation

places the client application in a state. The result of the client traversing a hyperlink in Boeing747.html

is another resource is accessed. The new representation places the client application into yet another

state. Thus, the client application changes (transfers) state with each resource

representation --> Representational State Transfer!

Wednesday, February 14, 2007

Test blog

This is just a test article