C# 3.0 : Automatic Properties

February 24, 2008

Hello ,

Being a C# programmer , you’ve used to leverage propcode snippet to create a property . C# 3.0 provides you with a nice feature called “Automatic Properties” which enables you to avoid having to declare private accessor field for properties and write get/set logic , this will make your code more concise and legible . However , you can still create regular properties and change get/set logic.

This is a property created by C# 2.0 :

        private string propertyName;
        public string PropertyName
            get { return propertyName; }
            set { age= propertyName; }

And this one is re-writed using C# 3.0 :

public string PropertyName { get; set; }

Implementing this feature , the compiler automatically creates the get/set logics . If you need to make the above property readonly , add private keyword before set accessor :

public string PropertyName { get; private set; }


.Net Framework Source Code is Now in Your Hands!

January 17, 2008

Hello ,

Last October , ScottGu announced that Microsoft is going to release Source Code for .Net Framework Class Libraries , Now It’s Available!

Right Now , you can browse and debug following .Net Framework Libraries with Visual Studio 2008 :

  • .NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, etc).
  • ASP.NET (System.Web, System.Web.Extensions)
  • Windows Forms (System.Windows.Forms)
  • Windows Presentation Foundation (System.Windows)
  • ADO.NET and XML (System.Data and System.Xml)

And they are going to provide source code for Windows Communication Foundation , Windows Workflow Foundation and LINQ in near future .

This helps programmers having a deeper perception of .Net Framework Class Libraries and understanding how thease libraries are implemented in order to build stronger Windows & Web Applications.

 Visit the following links for further information :

ScottGu’s Blog

Configuring Visual Studio to Debug .NET Framework Source Code