2

Hi I want to create code that is something like this:

public string randomString = "some Random String";

How can i set a value to the member field that I created using:

CodeMemberField field = new CodeMemberField("System.String", "randomString");

Thanks,

hajpoj
  • 13,299
  • 2
  • 46
  • 63

1 Answers1

3

Found it on another stackoverflow question

field.InitExpression = new CodePrimitiveExpression("some Random String"); 
hajpoj
  • 13,299
  • 2
  • 46
  • 63