473,491 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to make property inside a property

92 New Member
well, i wanna make property inside a property

for example see in System.Environment.OSVersions.Version , .Version is a property and thrs Major and Minor properties inside it, i wanna have something like it in C#.
Sep 13 '09 #1
3 4557
cloud255
427 Recognized Expert Contributor
@vishal1082
What you need to do is make one class a property of another class, using the example you supplied:

Version is a class, which contains Major and Minor as properties within this class. Version is also a property of the OSVersions class.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Public Class MyClass
  3. {
  4.       Public MyClass(){}
  5.       public int MemeberVariable;
  6. }
  7.  
  8. Public Class ContainerClass
  9. {
  10.      Public ContainerClass(){}
  11.      Public MyClass ClassMember;
  12. }
  13.  
  14. ... progam.cs ...
  15. ContainerClass container = new ContainerClass();
  16. container .MyClass.MemeberVariable = 0;
  17.  
  18.  
Sep 13 '09 #2
vishal1082
92 New Member
got it ty this 20 chracter limit is killing me
Sep 13 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
2053
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
3
1771
by: Nice Chap | last post by:
Is it possible to have custom property pages for a Component and if so how I can write one please ? Also, is it possible to reuse the drop down box that we get for Data Source and Data Member...
12
2657
by: Saurabh Kumar | last post by:
I have a byte array, which i need to send to a class, where it will be stored in an arraylist. I use the following property in the class to accept the byte array, but it seems that the array is...
13
1474
by: Samuel R. Neff | last post by:
I want to make my app repaint and show a wait cursor during a long running process but not actually respond to user events. What's the best way to implement this? If I just put the process on...
3
3549
by: Sam Kong | last post by:
Hi group, I want to have some advice about immutable objects. I made a constructor. function Point(x, y) { this.x = x; this.y = y; }
28
2904
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
7
2672
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
2
1547
by: | last post by:
I want to use codebehind to pass property values to a control that I've embedded INSIDE of a user control. In other words, let's say I have the following: MyPage.aspx ....with the following...
19
2408
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
0
7115
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
6978
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
7190
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...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
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...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4881
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...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
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 ...

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.