CodeVariableDeclarationStatement hashTableParam = new CodeVariableDeclarationStatement(); hashTableParam.Name = 'hashtable'; hashTableParam.Type = new CodeTypeReference(typeof(System.Collections.Hashtable));
In the above code i tried to do a basic declaration for hashTable. Now i need to added values to the hash table(key,value).
ht.Add('testKey','testData')
i.e how can i generate such code to add keys and values to HashTable programatically using codeDom
There is probably a way to do this that is more CodeDom oriented, which would allow for easier cross language support, but this will work
Assuming you already have a class created and a method, create a new CodeSnippetExpression and put the code you want in it, and then add that to your method body.