473,786 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Properties - public & protected

Just to verify, i cannot use properties and have a public get and a protected
set, correct?

i assumed i could either define it twice with different scopes or set the
access visibility at the get/set level but neither is true. So i assume this
means i have to stop using properties and use the Java-style getX()/setX()
methods. But i wanted to verify before i start doing that

-baylor
Jul 21 '05 #1
2 1171
"baylor" <ba****@discuss ions.microsoft. com> wrote in message
news:28******** *************** ***********@mic rosoft.com...
Just to verify, i cannot use properties and have a public get and a
protected
set, correct?
No, not in VS2002 & VS2003, but it will be available in VS2005.
i assumed i could either define it twice with different scopes or set the
access visibility at the get/set level but neither is true. So i assume
this
means i have to stop using properties and use the Java-style getX()/setX()
methods. But i wanted to verify before i start doing that

-baylor

Jul 21 '05 #2
Correct. A better alternative to to getX() and setX() might be to go
half-way:
Create a public read only property (only has a getter), and then a
protected setX.
The consumers of your class will still be able to take advantage of the
familiar property style for reading the value (which is all they can do
anyway).
baylor wrote:
Just to verify, i cannot use properties and have a public get and a protected
set, correct?

i assumed i could either define it twice with different scopes or set the
access visibility at the get/set level but neither is true. So i assume this
means i have to stop using properties and use the Java-style getX()/setX()
methods. But i wanted to verify before i start doing that

-baylor

Jul 21 '05 #3

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

Similar topics

23
391
by: Marcin Grzębski | last post by:
I red MSDN article of C# 2.0 this week... and i found very strange syntax for properties e.g.: public int MyIntValue { get { // ... } protected set { // ... }
4
1400
by: Andy Breward | last post by:
Hi I have created a range of usercontrols for displaying various bits of information. My question is if I wish to pass a parameter to the UserControl from the host page, is this possible? I have tried setting an attribute in the Server Tag which only works if I use a constant as it won't allow the <% =xxxx%> parameters within the control!
2
2033
by: Marty McDonald | last post by:
When setting certain datagrid properties with the IDE (as in the property window), they don't seem to take effect. For instance, Font Name. So I have to set these via code-behind at the cell level. Is this expected? Shouldn't anything on the properties window render accordingly? Thanks
2
1713
by: Vivek Sharma | last post by:
Hi There, I have a situation where I wish to load the controls dynamically on the basis of user role. Hence, I am using this code. if (UserRole == "IS Administrator") { Control UC1 = LoadControl("../UserControls/ISJob/uctlJobGeneral.ascx");
6
1264
by: Raterus | last post by:
Hello, Does anyone have any ideas how I can accomplish this using properties. I'm trying to create a property, that acts like a structure. Basically I'm trying to create a property that I could do this with. myCompanyIndex = currentCompany.Index myCompanyName = currentCompany.Value "currentCompany" would be the property, Index is an integer, Value is a
2
1729
by: Miky | last post by:
Hi, I'm looking resources or tutorial where I can learn how to add properties to other objects at design time for VB.NEt or C#. I want to reproduce the same effect as when your drop the tooltip object on a form. Once it's done, every object has a new property added to the property box so we can write the tooltip text. Syncfusion object does something like that when we drop a docking
2
303
by: baylor | last post by:
Just to verify, i cannot use properties and have a public get and a protected set, correct? i assumed i could either define it twice with different scopes or set the access visibility at the get/set level but neither is true. So i assume this means i have to stop using properties and use the Java-style getX()/setX() methods. But i wanted to verify before i start doing that -baylor
2
3734
by: mharness | last post by:
Hello, I've tried a number of examples showing how to read the properties of a user control from an aspx file where the code is on the html view of the form but I can't figure out how to read them from the aspx.vb. Can anyone tell me how to declare the user control in the aspx.vb file so that I can read the properties? I did add "Protected WithEvents UC1 As System.Web.UI.UserControl" to the component code behind form but that's the...
1
1691
by: Christophe Peillet | last post by:
I have a CompositeControl with two types of properties: 1.) Mapped Properties that map directly to a child control's properties (ex.: this.TextboxText = m_txt.Text). These properties are handled by their underlying classes (such as the TextBox control), and are not persisted by me. 2.) Unique Properties that don't map directly and are persisted in ViewState (ex.: this.LabelPosition, which specifies where on the form the label should be...
0
9647
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9496
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9961
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7512
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
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
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.