Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在使用 LINQ 时,我遇到了一个异常,它`1以一些表达式显示。
`1
例如在 stacktrace 中,我得到如下声明:
System.Linq.Table`1.Enumerable();
在一些匿名声明中,我也遇到了同样的情况。我的一个后辈问我这个问题,但我无法给他满意的答案。所以我需要知道。代表什么`1?
C# 将泛型类型标记为
System.Linq.Table<T>
VB 将它们记为
System.Linq.Table(Of T)
在类型对象上调用 ToString 既不会产生 C# 也不会产生 VB 语法;它产生:
System.Linq.Table`1
其中 1 表示类型参数的数量。
在 C# 中,类型如下:
Foo<T>.Bar<U>
会产生字符串
Foo`1+Bar`1