[.net] help with general question...

Started by
6 comments, last by GameDev.net 18 years, 4 months ago
I want to set a value to an int variable located at Gedcom.Header.Value ie: Gedcom.Header.Value = 1; But I need the location to change to set other values using the same prefix, ie: Gedcom.Header.StringValue = "0"; The question is this, how do I use the root Gedcom.Header and combine it with different endings ie: .Value and .StringValue to set each fields value? I thought maybe I could put the composite location in strings like this: "Gedcom.Header" + ".StringValue" and "Gedcom.Header" + ".Value" But I don't know how to use the string to set the values of each. Thanks in advance, Devin
Advertisement
sooo what language are you using? And I dont get what your asking exactly...
Do you want to do something like:
Gedcom.Header.StringValue = Gedcom.Header.Value; ?
DONT LET THEM DISCRIMINATE! BRING BACK THE BLACK!
using c#. What I'm trying to do is set a value in a class using a string as the address ie:

"Gedcom.Header.Value" = 1;

But of course the string "Gedcom.Header.Value" does not point to the location of Gedcom.Header.Value and thus wont set it's value to 1 like the following would:

Gedcom.Header.Value = 1;

So how can I tell the compiler that the string represents a .Net address?
Why dont you do

Gedcom.Header.Value = 1;?

Do you want to use pointers or something?
DONT LET THEM DISCRIMINATE! BRING BACK THE BLACK!
I'm using a data file to tell me where the values are.
make a std::map to map a string to a location:
map<string, int *> my_map;
my_map["Gedcom.Header.Value"] = &Gedcom.Header.Value

then you can apply a value to a location:
*(my_map["Gedcom.Header.Value"]) = 1;

The only drawback to this is that one map can only store pointers to one type of data. So, you still have
a slight problem of needing several maps for your integers, strings and such. In wich case you may want to
have a look at "dators" to store your data.

A dator will always take a string input to set the value, but a dator is linked to a static variable of another
type, and automagically converts your strings to the proper type. But, I don't have any code for setting
this up in C#. :(
I don't see what this has to do with DirectX. Moved to .NET.

Thanks, I like the map technique!

-Devin

p.s. Muhammad, I'm using it in a directX app?

This topic is closed to new replies.

Advertisement