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.
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_newsgroup s" <rowe_email@yah oo.comschreef in bericht
news:788fa5df-1883-422e-b829-642988a03ebe@e3 8g2000prn.googl egroups.com...
On Nov 13, 6:53 am, "Vic" <vserge...@tele net.bewrote:
Can a property dynamic be added to a class at runtime?
>
Best Regards, Vic
It sounds like you could declare a property "SalesPrice " as List(of Decimal)
"Vic" <vsergeant@tele net.bewrote in message
news:%23ilj6dZR JHA.1448@TK2MSF TNGP04.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_newsgroup s" <rowe_email@yah oo.comschreef in bericht
news:788fa5df-1883-422e-b829-642988a03ebe@e3 8g2000prn.googl egroups.com...
On Nov 13, 6:53 am, "Vic" <vserge...@tele net.bewrote:
>Can a property dynamic be added to a class at runtime?
>>
>Best Regards, Vic
>
Why would you need this?
>
Thanks,
>
Seth Rowe [MVP]
On Nov 13, 7:55 am, "Vic" <vserge...@tele net.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.
Comment