Auto-Implemented Properties c# .NET 3.0+

Instead of the following typical property setter/getter

private string courseName;
pubic string CourseName{
   get { return courseName;}
   set { courseName = value;}
}

 

//Auto-Implemented property implicitly creates an instance variable for property CourseName
public string CourseName {get; set;}

  • unable to use the private variable for this property (hidden from developer)
  • developer can only reference within the class via CourseName 

This is a reasonable approach for quick prototyping of properties only.

Author

Admin

comments powered by Disqus

Categories

Recent Tweets

@ACLU n to pay for a long time. I yu the
#Xamarin Certified Trophy arrived today! @XamarinU thanks! https://t.co/TpYsSkBW6Y
Retweeted by @dyardy #PowerShell and Kerberos double hop. Slides, module, and demos. aka.ms/pskdh #PshSummit
@danrigby @Raspberry_Pi Very cool, let us know how it goes, thx