我有一个现有的String
和HashSet(Of String)
,但以下代码
Dim myDict As New Dictionary(Of String, HashSet(Of String))(myString, myHashSet)
产生此Intellisense错误: Argument matching parameter 'comparer' narrows from 'System.Collections.Generic.HashSet(Of String)' to 'System.Collections.Generic.IEqualityComparer(Of String)'
创建此词典的正确方法是什么?
您可以使用Collection Initializer:
Dim myDict As New Dictionary(Of String, HashSet(Of String)) From
{{myString, myHashSet}}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句