简体   繁体   English

在C#中,在System.Collections.Generic.IEnumerable`1中IEnumerable之后1的含义是什么

[英]In C# what is the meaning of 1 after IEnumerable in System.Collections.Generic.IEnumerable`1

在IEnumerable之后1的含义是什么: System.Collections.Generic.IEnumerable`1

It is the generic arity of the type, or put another way, the number of type parameters a generic type supports. 它是该类型的通用arity,或换句话说,泛型类型支持的类型参数的数量。 IEnumerable<T> supports a single type parameter. IEnumerable<T>支持单个类型参数。 If you were to look at Dictionary<TKey, TValue> you would notice an arity value of 2. 如果您要查看Dictionary<TKey, TValue>您会注意到arity值为2。

Within the .NET type system, it is necessary that types have unique names. 在.NET类型系统中,类型必须具有唯一的名称。 Although it is only possible to create instances of bound generic types (eg IEnumerable<System.Int32> or IEnumerable<System.String> ), the unbound generic type may be used in certain contexts. 虽然只能创建绑定泛型类型的实例(例如IEnumerable<System.Int32>IEnumerable<System.String> ),但未绑定的泛型类型可以在某些上下文中使用。 Within the language C#, such type would be written as IEnumerable<> but within the type system it is notated as IEnumerable~1 [~ used to avoid format problems]. 在C#语言中,这种类型将被写为IEnumerable<>但在类型系统中,它被标记为IEnumerable~1 [〜用于避免格式问题]。 Note that the name of the bound generic type starts with the name of the unbound type, so if the unbound generic were called IEnumerable<> within the type system, the name of the bound generic would have to start with IEnumerable<> , including the back-to-back less-than-greater-than signs . 请注意,绑定泛型类型的名称以未绑定类型的名称开头,因此如果未绑定泛型在类型系统中被称为IEnumerable<> ,则绑定泛型的名称必须以IEnumerable<>开头, 包括背靠背不到大于标志

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#JSON错误=&gt;无法将JSON对象反序列化为类型&#39;System.Collections.Generic.IEnumerable`1 - C# JSON error => Cannot deserialize JSON object into type 'System.Collections.Generic.IEnumerable`1 C#,无法从“ System.Collections.Generic.IEnumerable”转换为“ string []” - C#, cannot convert from 'System.Collections.Generic.IEnumerable' to 'string[]' C# 无法将“字符串”转换为“System.Collections.Generic.IEnumerable”<string></string> - C# cannot convert 'string' to 'System.Collections.Generic.IEnumerable<string> C#:错误-无法将类型&#39;int&#39;隐式转换为&#39;System.Collections.Generic.IEnumerable <double> “ - C#: Error-Cannot implicitly convert type 'int' to 'System.Collections.Generic.IEnumerable<double>' 如何从 System.Collections.Generic.IEnumerable 转换<char> ' 到 C# 中的 'char[]'</char> - how to convert from System.Collections.Generic.IEnumerable<char>' to 'char[]' in C# system.collections.generic.list 到 system.collections.generic.ienumerable - system.collections.generic.list to system.collections.generic.ienumerable 无法从“ System.Collections.Generic.IEnumerable”转换为System.Collections.Generic.IEnumerable <string> - cannot convert from 'System.Collections.Generic.IEnumerable' to System.Collections.Generic.IEnumerable<string> 如何转换类型&#39;System.Collections.Generic.IEnumerable <AnonymousType#1> &#39;到&#39;System.Collections.Generic.IEnumerable &lt;&gt;&#39;。 - how to convert type 'System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'System.Collections.Generic.IEnumerable<>'. 无法从&#39;System.Collections.Generic.IEnumerable转换为System.Collections.Generic.IEnumerable <string> - Cannot convert from 'System.Collections.Generic.IEnumerable to System.Collections.Generic.IEnumerable<string> 无法从&#39;System.Collections.Generic.IEnumerable转换 <int> &#39;到&#39;System.Collections.Generic.IEnumerable <int?> “ - Cannot convert from 'System.Collections.Generic.IEnumerable<int>' to 'System.Collections.Generic.IEnumerable<int?>'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM