从字符串创建codeMemberMethod字符串、codeMemberMethod

2023-09-06 06:49:42 作者:亦不相会

我想产生一些$ C C使用codeDOM $。我想知道是否有什么办法可以从字符串创建codeMemberMethod。 我发现了一个方法,但它产生的组装,从字符串。我想生成字符串的一些方法。有什么办法?

I am trying to generate some code using CodeDom. I wanted to know if there is any way to create CodeMemberMethod from a string. I found a method, but it generates assembly from string. I wanted to generate some methods from string. Is there any way?

推荐答案

嗯,我找到了答案。希望这可以帮助别人:

Well, I found the answer. Hope it may help someone else:

我们可以使用 codeSnippetStatement 来包括将包括直接在源代码无需修改code片段。

We can use CodeSnippetStatement to include code fragments that will be included directly in source without modification.

除此之外,还有 codeSnippetCompileUnit 将编译code单位的字符串。

In addition to that, there is CodeSnippetCompileUnit that will compile code units from string literal.