Meeting the needs of your business from a distance

C# Properties

by Mark Shiffer 12/27/2007 4:19:00 PM

Ran across this today and did not realize that it could be done. In C# you can apply a different accessibility modifier to the get or set method of a property than that of the overall property. The least restrictive modifier is placed at the property level and the more restrictive modifier is placed in front of the get or set. This would come in handy when you want the property to be public available for read, but restricted for write access.

public string Name

{

get { return name;}

protected set {name = value;}

}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Research | Programming

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

July 9. 2008 00:24

About the author

Name of author Mark Shiffer
CEO & CIO of MS Consulting

E-mail me Send mail

Calendar

<<  July 2008  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in

    Copyright © 2001-2008 MS Consulting, Inc. All Rights Reserved.