Thursday 12 February 2009

c# 3.0 - Session 1

Session Overview 1 (Auto Implemented Properties)

  • Auto Implemented Properties
  • Prop and propg
Auto Implemented Properties allows you to implement public accessors for your classes private field quickly.

Following is the syntax to declare public accessor for the private field

For shortcut type “prop” and press tab twice.

For e.g. to declare employeeName field use the following shortcut.
public string EmployeeName { get; set; }


For readonly property type “propg” and hit tab twice.
public DateTime OrderDate { get; private set;}

No comments: