473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Property Access Modifiers

Is it possible to create a property and specify different access modifiers
for the get and set methods? From the property definition it appears that
you can define attributes but not access modifiers. I have never used
attributes so I don't know if they are useful for this purpose.

What I want to do is to create an 'Entry' class that will be used by two
other classes. One class will create the 'Entry', assign limits, a default
value ... The other class is the user interface. This class should have
permission to read all the properties but only set the value.

I believe that this can be accomplished with a protected constructor and
read only properties but I am curious if there is a way to control this on a
higher level. I have ran into similar problems in the past and would like
to hear how the more experienced tackle this.
thanks,
bob

Nov 15 '05 #1
2 2701
Bob,
Is it possible to create a property and specify different access modifiers
for the get and set methods?


Not yet, but it should be possible in the upcoming v2.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2
Hi Bob,

Thanks for you posting in the group!
What I want to do is to create an 'Entry' class that will be used by two
other classes. One class will create the 'Entry', assign limits, a default
value ... The other class is the user interface. This class should have
permission to read all the properties but only set the value.


How about to create 2 deferent sets of properties, one with all permissions
and protected access modifiers , and the other with only read permission
and public access modifiers, but they both focus the same set of member
variables.
Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Laurence Nuttall | last post by:
What is the modifiers property of a label mean? I looked in the help, but couldn't find any explantion for it. Thanks in Advance, Laurence Nuttall Programmer Analyst III
3
by: kchalla | last post by:
Can anybody let me know the difference between public and private class access modifiers? Thanks in advance
3
by: ORC | last post by:
How do I override the Size property in a user made Control (e.g.: public void Graph : Control). I'll need to set gridsize etc. that is dependent of the control size and therefore I thought that I...
4
by: Picho | last post by:
Hi all, Using reflection, I can invoke/call private methods of an object. is this intended? if yes, why? in what scenario (example would be good) should I be givven the option to use...
6
by: solex | last post by:
Is it possible to have two different access modifiers on a property? I used to be able to do this in VB6 but I cannot find the right syntax for ..NET. Thanks, Dan
7
by: Chris Adams | last post by:
Hello, I just finished an online tutorial regarding Visual Inheritance. It was very informative, despite the fact that I am still unclear on two of the settings for the Modifiers property. ...
7
by: Andrea Moro | last post by:
I'm writing my first windows control library. A simple textbox with some numeric facilities. Well, there is a strange thing that happen. I want to add a locked property. As many other property,...
2
by: Roy | last post by:
If I define a property as int age { get; set; } Is there a way to add different access modifiers to the accessors when implement?
2
by: Tony Johansson | last post by:
Hello! I just wonder what this mean it is written in a book called "Visual C# 2005" " The accessibilities that are permitted for accessors depends on the accessibility of the property, and it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.