473,387 Members | 1,757 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.

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 1145
"baylor" <ba****@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.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
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
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...
2
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...
2
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 =...
6
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...
2
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...
2
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...
2
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...
1
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...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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.