CodeVariableDeclarationStatement hashTableParam = new CodeVariableDeclarationStatement(); hashTableParam.Name = 'hastable'; hashTableParam.Type = new CodeTypeReference(typeof(System.Collections.Hashtable)); CodeMethodInvokeExpression invokeExp2 = new CodeMethodInvokeExpression(new CodeVariableReferenceExpression(hashTableParam.Name), 'add'); invokeExp2.Parameters.Add(new CodeArgumentReferenceExpression('key')); invokeExp2.Parameters.Add(new CodeArgumentReferenceExpression('value')); return hashTableParam;
I need to use the above code in a method that returns, CodeAssignStatement.? how can i do so.?
As far as I can tell, the only sensible
CodeAssignStatementin the above would be something like (untested):However, this assignment (returned at this point) won’t include the key/value addition. What exactly is it you are trying to do?