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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:47:44+00:00 2026-05-17T18:47:44+00:00

class Statistics { Dictionary<decimal, Statistic> BabyDataStandardAgeHeadCircumference; Dictionary<decimal, Statistic> BabyDataStandardAgeLength; Dictionary<decimal, Statistic> BabyDataStandardAgeWeight; Dictionary<decimal, Statistic>

  • 0
 class Statistics
{
    Dictionary<decimal, Statistic> BabyDataStandardAgeHeadCircumference;
    Dictionary<decimal, Statistic> BabyDataStandardAgeLength;
    Dictionary<decimal, Statistic> BabyDataStandardAgeWeight;
    Dictionary<decimal, Statistic> BabyDataStandardWeightForLength;


}

These data are fixed – readonly and i want to load them from the database.
The problem is

  1. How to make them readonly ?(i know
    through properties)
  2. How to fill them with data at program startup ?

Calling a method like Statistics.load() from startup event seems poor to me..

  • 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-17T18:47:44+00:00Added an answer on May 17, 2026 at 6:47 pm

    Question:

    How to make them readonly ?(i know
    through properties)

    Answer: Rather than using a Dictionary<decimal, Statistics>, think about using an immutable wrapper for the dictionary.

    SO link for an implementation of an immutable Dictionary class here:

    Does C# have a way of giving me an immutable Dictionary?

    Question:

    How to fill them with data at program
    startup ?

    Answer: Rather than fill them with data at program startup, how about filling them at the first access to the class (static or instanced)? This would mean populating these dictionaries in the static constructor (naturally the dictionaries would have to be static members as well).

    public class Statistics
    {
        public static readonly ImmutableDictionary<decimal, Statistic> 
            BabyDataStandardAgeHeadCircumference;
        public static readonly ImmutableDictionary<decimal, Statistic> 
            BabyDataStandardAgeLength;
        public static readonly ImmutableDictionary<decimal, Statistic> 
            BabyDataStandardAgeWeight;
        public static readonly ImmutableDictionary<decimal, Statistic> 
            BabyDataStandardWeightForLength;
    
        static Statistics()
        {
            // populate the dictionaries here...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to present general statistics about the instances of the class ModelClass on
For instance, in class Athlete I have: uint ID; string Name; Dictionary<string, string> statistics
I have a question regarding class design. I want to have a class that
I am working on a website statistics engine for a class. The idea being
I have a QueueProcessor class that processes a work queue. I want to send
I have this class: public class Statistics { List<string> _lsit; public List<string> ipList {
In my statistics class we use Stata and since I'm an R user I
I have a template statistics class that has range parameters. template <typename T> class
I want to build a statistics generator that should be able to use intervals
I have a JFrame that is the main class of the program. I want

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.