473,505 Members | 14,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Class Property

Vic
Can a property dynamic be added to a class at runtime?
Best Regards, Vic
Nov 13 '08 #1
5 1275
"Vic" <vs*******@telenet.beschrieb
Can a property dynamic be added to a class at runtime?
No. Writing properties is a programmer's task and done before compilation.
Maybe you want to store additional values related to an object? Then have a
look at the various collections available; you could use the object as the
key.

http://msdn.microsoft.com/en-us/library/0ytkdh4s.aspx
Armin

Nov 13 '08 #2
On Nov 13, 6:53*am, "Vic" <vserge...@telenet.bewrote:
Can a property dynamic be added to a class at runtime?

Best Regards, Vic
Why would you need this?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Nov 13 '08 #3
Vic
Thx for the replay.
The reason for this, dependent of a setting i need a articleobject with
between 1 and 20 salesprices properties. But if it is not possible i will
code the 20 properties.

Vic

"rowe_newsgroups" <ro********@yahoo.comschreef in bericht
news:78**********************************@e38g2000 prn.googlegroups.com...
On Nov 13, 6:53 am, "Vic" <vserge...@telenet.bewrote:
Can a property dynamic be added to a class at runtime?

Best Regards, Vic
Why would you need this?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Nov 13 '08 #4
It sounds like you could declare a property "SalesPrice" as List(of Decimal)

"Vic" <vs*******@telenet.bewrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Thx for the replay.
The reason for this, dependent of a setting i need a articleobject with
between 1 and 20 salesprices properties. But if it is not possible i will
code the 20 properties.

Vic

"rowe_newsgroups" <ro********@yahoo.comschreef in bericht
news:78**********************************@e38g2000 prn.googlegroups.com...
On Nov 13, 6:53 am, "Vic" <vserge...@telenet.bewrote:
>Can a property dynamic be added to a class at runtime?

Best Regards, Vic

Why would you need this?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Nov 13 '08 #5
On Nov 13, 7:55 am, "Vic" <vserge...@telenet.bewrote:
The reason for this, dependent of a setting i need a articleobject with
between 1 and 20 salesprices properties. But if it is not possible i will
code the 20 properties.
Rather than code 20 properties, add a single property that is a List
(Of T) for holding your prices.

Private _salesPrices As List(Of Decimal)

Public ReadOnly Property SalesPrices As List(Of Decimal)
Public Get
Return _salesPrices
End Get
End Property

Then you can have as many or as few sales prices as you wish.

Chris
Nov 13 '08 #6

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

Similar topics

3
13699
by: Guy Harwood | last post by:
Hi, I have designed a textbox that inherits from the System.Windows.Forms.Textbox control. when the control is readonly the back color changes to a light blue to indicate that it is frozen. ...
2
2549
by: Zac | last post by:
Alright anyone who has 2c throw it in... I am working through a custom xml serializer and have come upon a conundrum, given our class design. The interface implemented on the base class (base...
4
3367
by: Richard Abraham | last post by:
I have created a new class ServiceTimer based upon the .NET System.Timers.Timer class. This has a new property CollectionIntervalMinutes which I expected to be added to the 'Behavior' section of the...
2
1592
by: Codex Twin | last post by:
Hi I am designing a class (Q) which will contain provision for dynamic complex properties. For example, these properties could be any or all of the following complex properties: a)...
1
3330
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new...
4
1253
by: funVB2005fun | last post by:
I am not quite sure what I am getting into but I would like to have a loop that read from a flat file to create some public properties in a class. I am going after this to try and create more...
2
3621
by: Luis Arvayo | last post by:
Hi, In c#, I need to dynamically create types at runtime that will consist of the following: - inherits from a given interface - will have a constructor with an int argument
3
1933
by: Dan | last post by:
Is it possible to dynamically create and populate properties? Below is my class. I would like to define properties for each of the items in my two arrays without actually defining each one. (There...
5
2043
by: cwertman | last post by:
I have a question regarding dynamic properties. I have an Object say Account --Id --Prefix --Fname --Lname --Suffix
15
10832
by: EDBrian | last post by:
My problem is this. Our clients create different fields they want to collect and we allow them build dynamic filters, reports etc... We run some TSQL to actually create the column and all works...
0
7216
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
7098
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
7303
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,...
1
7018
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
7471
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
5613
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
5028
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
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
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.