473,586 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2733
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
2205
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
1742
by: kchalla | last post by:
Can anybody let me know the difference between public and private class access modifiers? Thanks in advance
3
3999
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 would set these properties in the overriden Size property., but I get an error message when trying this: public override Size Size { set { some...
4
3200
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 something that was declared private (not public) and not mine to use? seems to me this is somewhat malicious... if not.... well....
6
8837
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
1137
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. I understand how to use the Private & Public settings, but became confused on the purpose of the Protected & Friend settings.
7
4432
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, because it's a default property, I must shadow it, but unfortunately, despite the other properties shadowed, for instance tabindex, locked continue...
2
1320
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
1122
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 is forbiden to make an accessor more accessible than the property it belongs to. This means that a private property cannot contain any...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.