Properties Setting C# Windows Form Application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hussey
    New Member
    • Feb 2013
    • 2

    Properties Setting C# Windows Form Application

    Please tell me can we create a property setting Name and its type during the running time application C#????

    a lot of thanks in advance
  • michaeldebruin
    New Member
    • Feb 2011
    • 134

    #2
    As far as I know it ain't possible.

    Comment

    • Joseph Martell
      Recognized Expert New Member
      • Jan 2010
      • 198

      #3
      Since C# is a strongly typed language: no, you cannot create a new property and set it during runtime.

      Whate you can do is create a dictionary for a specific class defined as:
      Code:
      Dictionary<string, string> _dynamicProperties = new Dictionary<string,string>();
      This allows you to create and delete new "properties " for a class during runtime. It stores all values as strings, but that should allow you to handle a lot of situations. If you need specific type checking there are other solutions, but they get way more complicated.

      Comment

      Working...