Originally posted by Bodybag
dim s as string= "John"
response.write (s)
string s = "John";
response.write (s);
Originally posted by samsmithnz
Its almost exactly the same in C#.
Code:string s = "John"; response.write (s);
$name1 = "Fredrik";
$name2 = "Andreas";
$var = "name1";
echo $var . " = " . ${$var};
echo "<br>";
$var = "name2";
echo $var . " = " . ${$var};
echo "<br>";
name1 = Fredrik
name2 = Andreas
$name1 = "Fredrik";
$name2 = "Andreas";
$var = "name1";
echo $var . " = " . ${$var};
echo "<br>";
$var = "name2";
echo $var . " = " . ${$var};
echo "<br>";
Dim vars As New Collections.Specialized.StringDictionary
vars.Add("Name1", "Frederik")
vars.Add("Name2", "Andreas")
Dim name As String = "Name1"
Response.writeline(vars(name)
Originally posted by PlausiblyDamp
Not sure if you can do it exactly the way you say but you could achieve something similar with a collection.
Code:Dim vars As New Collections.Specialized.StringDictionary vars.Add("Name1", "Frederik") vars.Add("Name2", "Andreas") Dim name As String = "Name1" Response.writeline(vars(name)
string name1 = "Superman";
string name2 = "Batman";
name1 = name2;
Originally posted by iebidan
I dont see the use for what youre asking, seems to me like more memory consumption, if I want to copy the value of 1 variable into another variable Ill do something really simple
There you go, I assigned the value of the second variable into the first one, whats the result ? "BATMAN", why do things the hard way?????, this is exactly the same thing youre doingC#:string name1 = "Superman"; string name2 = "Batman"; name1 = name2;