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 8111515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:09:09+00:00 2026-06-06T02:09:09+00:00

I am sure I am not going to use the correct words to explain

  • 0

I am sure I am not going to use the correct words to explain but I hope you understand what I am trying to accomplish.
I have a class that gets passed in dictionary collection. Is it mandatory that this passed in dictionary collection has certain keys that this class needs. I would like to be able to expose publicly those keys needed by the class, but not just as strings, but actual items. An enumeration would work but since this class is a base class I dont think that is a good solution. I need something similar to the Resources class that is generated everytime you add items to the Resources.resx file. So you that you can just go to Resources.Resources.MyLabel1, Resources.Resources.MyLabel2, etc.
Is this possible?

Thanks,
Mike

  • 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-06T02:09:12+00:00Added an answer on June 6, 2026 at 2:09 am

    You could just offer a static or const member on your class:

    class PickyClass {
      public static readonly string[] RequiredKeys = new[] {"length", "width"};
    
      /// <summary>
      /// Please note that you must include at least RequiredKeys in values
      /// </summary>
      public void Setup(Dictionary<string,string> values)
      {
        ...
      }
    }
    

    (edit) or is it important that they are addressable by name? In which case, how about:

    class PickyClass {
      public class RequiredKeys
      {
        public const string Length = "length";
        public const string Width = "width";
      }
    
      /// <summary>
      /// Please note that you must include every const in RequiredKeys in values
      /// </summary>
      public void Setup(Dictionary<string,string> values)
      {
        ...
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure what's going on here, but my iPhone apps nav bar shows back
I'm not sure what's going on, but on my own laptop, everything works okay.
I'm not sure what's going on here but here's a section I'm having problems
I am not sure if I am going about this the best way, but
I'm trying to extend (not sure what is the correct term for this kind
I do not really use any try/catches in my code ever but I'm trying
Not sure whats going on here, or what could be the integer in this
Not sure what's going on here... My controller methods looks like this: [HttpGet] public
I am not sure if what I am going to ask is actually an
CSS is not my strong suit, and I am not sure what's going on

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.