How can I create and use a variable

October 27, 2010 at 03:00:00
Specs: Windows XP, P-IV 2.8GHZ/1GB
How can I create and use a variable from two or more strings or varialbe.
The context is

string num40 = "fourty"; // I have to use this value in my amttoword module
string val = "40";
Console.WriteLine("The value of num40 is " + num&val);

num&val -> here &val is used as value of val(i.e. 40) and num&40 results as num40 which stores "fourty". I have a use of this. The logic here I used with Clipper 87 database programming language. But I dont know how to use in C#. Please help.

See More: How can I create and use a variable

Report •

October 27, 2010 at 06:02:04
This technique is more common in interpreted, rather than compiled, languages. I'm not sure if there is a better solution, but in C# you can use a dictionary collection and store your variable name as the key.

Report •

October 27, 2010 at 12:52:42
In C#, there is almost always a better way to do what you're attempting to do. In this case, either an array or one of the many collection classes.

How To Ask Questions The Smart Way

Report •

Related Solutions

Ask Question