Big table of constants initialising

  • Thread starter Thread starter Serj Kondryukov
  • Start date Start date
S

Serj Kondryukov

I am novice in C#. I did write on C++ before.
In my current program i need to use big constant table. Each string is a
some struct what contain following fields:

MyEnum f1;
MyEnum f2;
bool f3;
double[] f4;
ushort[] f5;

Fields f1 and f2 have enum type what i define early. Last two fields is a
arrays by 9 items. Now i need get some f1, f2 and f3 values + some index and
find corresponding row in my table and corresponding index ushort and double
from last fields.
I don't want to put my table in external file. What offers do you have ? I
have some myself ideas but may be i don't know a some C# specifical features
for it.

Thank you.
 
Hi,

First of all, you will have to create and fill it at least once :)

What you could do is serialize the collection to a file, then include this
file in your project as an "embedded resource" doing so will put the file
inside your main output ( .exe or .dll ) then at runtime you can access it
and recreate your collection from it. easier and faster that create the
collection all the time.

how do you store your table? cause you will need a class that support
serialization, take a look at ISerializable interface and
SerializableAttribute , there are articles in MSDN too that you should read.


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top