2015-05-04 159 views
0

我想用我自己的编译器(的CodeDOM)编译代码,但像这样的代码:编译代码 - 错误CS1056“`”

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. 

回答

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 
0

的反引号应该从代码被删除。这是错误代码暗示的。

他们可能被添加,因为你从这个代码示例系统的一部分过度逃脱。

+0

我们确定删除该字符会起作用吗?这应该如何写: 'System.Threading.Tasks.Task \'1 [System.Threading.Tasks.VoidTaskResult]' –

+0

我将坚持这种观点,因为我很快浏览了文档,并且没有没有把反作用看成是一个有效的角色。此外,错误代码明确告诉你,它不期望在这些位置上的反引号字符。 – Makoto

+0

好吧,因为代码不是我写的,就像这个变量是从'System.Reflection.PropertyInfo.PropertyType' –