Is it possible to convert a string value to a variable name ?

Considering the following example

AddNode(treeview, "root", "This is the root");

public void AddNode(TreeNode parent, string nodeName, string nodeValue)
        {
            // what i want to happen is here to be created node with the name "root"

            // TreeNode root = new TreeNode(nodeValue);
            // parent.Nodes.Add(root);

            // so is there a way to convert the string value of nodeName to 
            // somehow get it as a variable name

            
        }

If i understand your question correctly you can use the name property of the created treenode(root.Name = nodeName) to set the name of 'root; to a string.

>convert string to a variable name

Maybe you should have to look at Dictionary<K,V>.

Dictionary<string,string> val=new Dictionary<string,string>();
 val.Add("var1","value1");
 ...
This question has already been answered. Start a new discussion instead.