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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:25:50+00:00 2026-05-12T05:25:50+00:00

I am currently writing a plugin to a CAD style software. The plugin does

  • 0

I am currently writing a plugin to a CAD style software. The plugin does calculations based on data read from the CAD model and a lot of table lookups (think printed tables in a calculation guide). I inherited this plugin and the current solution defines a class Constant which has a bunch of static struct members and two-dimensional arrays. These arrays are then indexed by enum values at runtime to find the appropriate data.

I’m not too happy with the solution, as the representation in the Constant class is kind of hard to read – the enum values used when retrieving data are of course not visible when editing the data (although that only ever happens manually and very seldom).

I’d prefer not to bundle a DB (and engine) with a small plugin, but would like similar semantics, for instance using LINQ to select values where some fields match etc.

What is your preferred solution to this problem?

  • do you use a bunch of XML files and parse them at runtime?
  • do you use a templating engine (t4?) to generate classes from XML files at compile time?
  • do you store XML versions of datasets in the resources (read ’em in at runtime, LINQ to dataset…)
  • would you just keep the Constants class, maybe add some documentation to the members (don’t get me started about legacy code with no comments whatsoever…)
  • 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-12T05:25:51+00:00Added an answer on May 12, 2026 at 5:25 am

    I’m doing that at the moment for a performance-critical application. The way I do it is by serializing the data in a flat file (as part of my release process), then (at launch) deserializing it into a class model, allowing LINQ-to-Objects querying.

    In most scenarios xml would be reasonable, but by preference I’m using my own binary serializer – mainly for speed.

    Since the constant data doesn’t change, it is usually fine to cache it away in an instance you keep handy and re-use many times (rather than deserialize it per use).

    To clarify: the data to use is stored in a standard database (they are good at that type of thing, and lots of tools exist for import / edit / query / etc). As part of my release process, I load the data into the object model (using the same classes) from the database, and serialize it:

    // during release
    MyDataModel data = new MyDataModel(); // wraps multiple data lists
    data.Load(); // from database tables, using ORM
    data.Save("data.bin"); // serialization
    

    then I ship data.bin with the app (well, actually it is stored separately, but that is an aside…); and at runtime:

    MyDataModel data = new MyDataModel();
    data.Load("data.bin"); // deserialization
    data.Freeze(); // make immutable
    

    Note that in this case, the data is “popsicle immutable” – i.e. to preserve the “constant” nature (but while letting it edit the data during load), I have a cascading Freeze method that sets a flag on the items; once this flag is set, all edits (to items or to lists) throw an exception. This has zero performance impact or the running code: since you expect to treat it as constant data, it only does reads!

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

Sidebar

Related Questions

I'm currently writing a JQuery plugin that loads colors from a JSON web service
I'm currently writing a plugin and have run into and issue that, from searching
I'm writing a plugin for Eclipse that collects some data from the project that's
I am currently writing a ruby plugin for a 3d drawing application(written in c
I am currently writing a program using Weka that builds a model (using one
I am currently writing a simple IOS app that saves tasks into a table.
I'm currently writing a Powershell script that's used to select a user from Active
I'm currently writing a WordPress plugin and I am having trouble getting the permissions
I'm currently writing a Winamp plugin framework for C# (basically, a C# implementation of
Currently I'm writing a jQuery plugin with some options. An example simplified piece of

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.