Objects and properties of properties

Okay, this should be an easy object oriented C# question, but for some reason I have been unable to find the answer yet.

I am creating an object of my own called JAddress. And basically I want to be able to do the following:
JAddress.ZipCode.Text
JAddress.ZipCode.MyId
I am unsure on how to create the second level of properties! Doing only a first level is really easy.....
public string ZipCode

{
get { return m_ZipCode; }
set { m_ZipCode = value; }
}
Does anyone know how to do this?
Thanks in advance,
csdietrich
0
csdietrich
7/16/2004 7:02:11 PM
📁 asp.net.getting-started
📃 91979 articles.
⭐ 4 followers.

💬 2 Replies
👁️‍🗨️ 936 Views

You would have its own ZipCode type (class) which is exposed in JAddress via ZipCode property (which probably is read-only, depending how you expose ZipCode via JAddress). This ZipCode type would have those Text and MyId properties
Thanks,

Teemu Keiski
Finland, EU
0
joteke
7/16/2004 7:59:45 PM
I'm quite the novice at doing some of this object oriented stuff. Could someone provide me with a quick example of how to do what was explained? I've been trying it for a while, but I'm getting all mixed up in the private, public, protected syntax.

Thanks!
0
csdietrich
7/19/2004 9:39:39 PM
Reply:

Similar Posts: