Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8457751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:53:26+00:00 2026-06-10T12:53:26+00:00

As I asked at title, Is it possible to set a dynamically created property

  • 0

As I asked at title,

Is it possible to set a dynamically created property name from database or from an external value in C#?

If yes then how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:53:28+00:00Added an answer on June 10, 2026 at 12:53 pm

    Typically, the best way to handle this is to store the value within a Dictionary<string, object> (or even Dictionary<string, dynamic>, or some other class as a value). This provides you a way to use a “dynamic property name” (the key) along with a value.

    While a custom DynamicObject will allow you to add dynamic members at runtime based on an external source, using those properties becomes problematic, as you don’t know how to refer to them from your code.

    EDIT: code example:

    Dictionary<string, object> myValues = new Dictionary<string, object>();
    myValues.Add("FieldName", "valueFromDatabase");
    //to get value back
    object val = myValues["FieldName"];
    //or if not sure value exists
    if (myValues.TryGetValue("FieldName", out val))
    {
        //do something with val
    }    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty much as the title. I have been asked if it is possible to
Possible Duplicate: selecting items that come after a specific value i asked this allready
Question is already been asked in title. Here is a code: (function($){ var filter
I asked a question , title of which might have been misleading so I'm
Please don't confuse with the title as it was already asked by someone but
I asked my friend if he can print from 1 to 1000 without using
Question is simple and asked in the title. C# 4.0 Specification says: (§4.2.2) The
Basically what I've asked in the title. How can I use the Ant symlink
I know that question with same title has been asked almost 6 month ago.
I asked question before asking if it is possible to save complex class composition

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.