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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:34:27+00:00 2026-06-15T12:34:27+00:00

Is it possible to have a resource file with entries that have multiple values.

  • 0

Is it possible to have a resource file with entries that have multiple values.

Eg. Id like to have something like.

Resource.CanViewSection.Value
Resource.CanViewSection.Description.

My reason for this is that our database is being created with the code first approach, and we’re going to need to implement very granular permissions in our application, so i’m expecting a lot of permissions & or possible repetition of items, and id like to centralize them all.

Thus in our database seeder i can do something like this:

private IEnumerable<Permission> SetupParameterPermissions()
{
    var innerCollection = new List<Permission>
        {
            //id like to do this
            this.New(Resource.CanViewSection.Value, Resource.CanViewSection.Description),

            //instead of this
            this.New("CanViewSection", "User can view the section")
        };

    return this.SetGroupId(innerCollection, PermissionGroupEnum.Parameters);
}

and in our services we can just run our access checks against the resource as well like this:

eg.

if(UserHasAccessTo(Resource.CanViewSection.Value))
{
// do something amazing
}

I’ve tried a few approaches, EG. adding a name to the value column of the resource & a description to the comment section, but i don’t know how to programatically access the comments column of the resource file.

I realize I can achieve this effect with ENUMS as well, but i’m second guessing what the best approach would be, as we’ll have a ton of permissions, and somehow the idea of a gigantic ENUM with 2 equally gigantic extensions weirds me out.

    public enum SomeEnum
    {          
        CanViewSection
    }    

    public static class SomeEnumExtensions
    {           
        public static string GetValue(this SomeEnum)
        {
            switch (me)
            {
                case SomeEnum.CanViewSection:
                    return "CanViewSection";
                default:
                    return "Fail!";
            }
        }

        public static string GetDescription(this SomeEnum)
        {
            switch (me)
            {
                case SomeEnum.CanViewSection:
                    return "YOLO!";
                default:
                    return "Fail!";
             }
        }
    }

I’m open to other suggestions as well?

  • 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-15T12:34:29+00:00Added an answer on June 15, 2026 at 12:34 pm

    Maybe you can try this (or something like it):

    1) Create resource file with your ID’s. F.e.

       Resource.Code1
       Resource.Code2
    

    2) Create XML file and add it to project. It will look probably like this:

       <codes>
              <Code1 Value="Some value text" Description="Some description">
              <Code2 Value="Some value text" Description="Some description">
       </codes>
    

    3) Create some kind of wrapper class with 2 fields – Value and Description, f.e.

        public class ResourceWrapper
        {
        public string Value {get;set;}
        public string Description{get;set;}
        }
    

    3) Then create simple static method which will get value from XML file by code from your resource file, parse it, and return ResourceWrapper as a result.

      public static class ResourceHelper
      {
            public static ResourceWrapper GetSomeWrapper(string resourceCode);
      }
    

    Calling will look like (in your case):

      ResourceWrapper wrap = ResourceHelper.GetSomeWrapper(Resource.Code1.ToString());
      this.Add(new Permission(wrap.Value, wrap.Description));
    

    Probably you would like to store a collection of already wrapped objects in some kind of cache, or else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

changing a static resource during runtine is something that sounds not possible. I have
Suppose I have a resource xml file like this: <?xml version=1.0 encoding=UTF-8?> <resources> <array
I have a simple question Is it possible to download a specific resource file
Is it possible to have multiple resource bundles in spring mvc? I want to
I have discovered that it is possible to populate resource strings with variable information
Is it possible to add some value from resource file right into the XAML
I have a spinner that is created using the resource file statically. now i
I am storing a set of values in a resource file (resx) and have
Is it possible to have an AndroidManifest.xml and or resource files in a Jar
Is it possible to have a free iPhone app that has say an initial

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.