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

  • Home
  • SEARCH
  • 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 6113903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:54:44+00:00 2026-05-23T14:54:44+00:00

I am holding structured read only data in enum type, now I would like

  • 0

I am holding structured read only data in enum type, now I would like to extend structure and for every value in enum add additional fields. So, my original enum is:

public enum OutputFormats { Pdf, Jpg, Png, Tiff, Ps };

and I want to extend them like so:

Value=Pdf
FileName="*.PDF"
ID=1

Value=Jpg
FileName="*.jpg"
ID=2

…and so on.

An enum can’t hold a multidimensional data structure, so what is generally considered the best “place” to hold such structured data? Should I create a class with value, filename, and id properties and initialize the data in the class constructor?

  • 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-05-23T14:54:45+00:00Added an answer on May 23, 2026 at 2:54 pm

    Perhaps this pseudo-enum pattern will be useful:

    public class OutputFormats
    {
        public readonly string Value;
        public readonly string Filename;
        public readonly int ID;
    
        private OutputFormats(string value, string filename, int id)
        {
            this.Value = value;
            this.Filename = filename;
            this.ID = id;
        }
    
        public static readonly OutputFormats Pdf = new OutputFormats("Pdf", "*.PDF", 1);
        public static readonly OutputFormats Jpg = new OutputFormats("Jpg", "*.JPG", 2);
    }
    

    Another variation, perhaps more concise:

    public class OutputFormats
    {
        public string Value { get; private set; }
        public string Filename { get; private set; }
        public int ID { get; private set; }
    
        private OutputFormats() { }
    
        public static readonly OutputFormats Pdf = new OutputFormats() { Value = "Pdf", Filename  = "*.PDF", ID = 1 };
        public static readonly OutputFormats Jpg = new OutputFormats() { Value = "Jpg", Filename = "*.JPG", ID = 2 };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I store a large structure holding my application's reference data in a variable I
I'm using ConcurrentQueue<T> for a shared data structure which purpose is holding the last
I have a class holding complex scientific computations. It is set up to only
I am looking for a class that defines a holding structure for an object.
I have a large data structure that is using striping to reduce lock contention.
Really my question is, if I were to use a nested data structure in
Based on couple of Api Calls I have constructed the following data structure (Dictionary).
I have a structure holding 3d co-ordinates in 3 ints. In a test I've
How do I make a tree data structure in C++ that uses iterators instead
Let's say I have data structures that're something like this: Public Class AttendenceRecord Public

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.