Naming objects

Oct 26 2006 7:58 AM
Is there any way of naming a object from a variable? I know in PHP this is easely done since variables has a $ infront of them.

Using PHP Variables in C# (if this was possible):
$varName = "myBook"; Book $varName = new Book()
It will be named what the variable $varName contains.

Using C#:
string varName = "myBook"; Book varName = new Book();
This will produce an error saying you cant convert varName from string to Book since its allready defined.

So what am I looking for? A way to name Objects from Variables. The objects NAME (Book NAME = new Book();) should be named what the variable contains!
Thx for any help or information.

Answers (3)