Dynamic Class Property

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vic

    #1

    Dynamic Class Property

    Can a property dynamic be added to a class at runtime?


    Best Regards, Vic


  • Armin Zingler

    #2
    Re: Dynamic Class Property

    "Vic" <vsergeant@tele net.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

    Comment

    • rowe_newsgroups

      #3
      Re: Dynamic Class Property

      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]

      Comment

      • Vic

        #4
        Re: Dynamic Class Property

        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]



        Comment

        • Family Tree Mike

          #5
          Re: Dynamic Class Property

          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]

          >

          Comment

          • Chris Dunaway

            #6
            Re: Dynamic Class Property

            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.

            Chris

            Comment

            Working...