编译代码 - 错误CS1056'`'

时间:2015-05-04 14:21:34

标签: codedom

我正在尝试使用自己的编译器(CodeDOM)编译代码,但是对于这样的代码:

390.   sealed class FunctorComparer`1 {
421.   public System.Array+FunctorComparer`1[T] () {}
448.   abstract public interface IEnumerator`1 {
... (1676 matches) ...

我收到此错误:

c:\Users\[Username]\AppData\Local\Temp\0z4zag32.0.cs(390,29) : error CS1056: Unexpected character '`'

我错过了什么?

[EDIT (1, "16:25", "4 May")]
the code i m trying to compile is not written by me. I don't know what that
character stands for, learning it. But i found that on this site
http://submain.com/ghostdoc/samples/PowerCollections/HTML/html/75549028.htm
it is being used, and it is strange the CodeDOM doesnt parse it.

2 个答案:

答案 0 :(得分:0)

应该从代码中删除反引号。这就是错误代码暗示的内容。

由于您从系统中获取此代码示例的过度逃避,可能会添加它们。

答案 1 :(得分:0)

任何成员的名称(字段,属性,方法,类)都不能包含字符

'`'

如果您正在阅读

中的详细信息
System.Reflection

它会添加这个角色,我不确定它是否需要,可能是因为它超过虚拟成员x次。像

System.Threading.Tasks.Task`1[System.Threading.Tasks.VoidTaskResult] //1 time
System.Threading.Tasks.Task`6[System.Threading.Tasks.VoidTaskResult] //6 times

完成声明的第一部分已完成,并包含计算机完成工作所需的所有信息。

from
System.Threading.Tasks.Task`1[System.Threading.Tasks.VoidTaskResult]

to
System.Threading.Tasks.Task