- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个类型为 StringDictionary 的新属性,但是当我像 stringdictionary 变量一样使用该属性时,出现错误。
目标是不使用变量,我需要为此使用属性。在幕后,我将 stringdictionary 值保存到全局用户 ID 索引集合。这是创建属性并尝试获取和设置的代码:
Public Property MaxLenDict As StringDictionary()
Get
Return GetFromCollection("MaxLenDict")
End Get
Set(Value As StringDictionary())
SaveToCollection("MaxLenDict", Value)
End Set
End Property
Public Sub ExampleSub()
If MaxLenDict("hello world") = "" Then MaxLenDict.Add("Hello World", "I'm Here")
End Sub
MaxLenDict("hello world")=""
最佳答案
您的属性(property)类型为 StringDictionary()
(一个数组!),而不是 StringDictionary
.
我不确定是否使用 StringDictionary
不过,首先建议。该类只是 .NET 的前泛型版本的残余。使用 Dictionary(Of String, String)
相反。
关于VB.NET 属性作为 StringDictionary?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11818117/
我想做的是拥有一个项目方面的静态字典,这样我就可以从代码中的任何位置访问单个列表。 直到现在,我想出了这个解决方案,一个具有公共(public)属性的公共(public)静态类: public sta
我创建了以下内容以将一些数据公开为正则表达式匹配字符串和 StringDictionary。感觉我可以用更少的行数使用 LINQ 来做到这一点。 private const string STREET
我创建了一个类型为“System.Collections.Specialized.StringDictionary”的用户范围设置。每当我打开本地设置时,我都可以在配置中看到它,但它是空的。 我有其他
我正在使用 StringDictionary 集合来收集键值对。 例如: StringDictionary KeyValue = new StringDictionary(); KeyValue.Ad
我正在尝试创建一个类型为 StringDictionary 的新属性,但是当我像 stringdictionary 变量一样使用该属性时,出现错误。 目标是不使用变量,我需要为此使用属性。在幕后,我将
按值(而非键)顺序对 StringDictionary 进行排序(或迭代)的“最佳”方法是什么 例如键-值 1 - X 标签 2 - 一个标签 3 - 其他标签 会给 2 - 一个标签 3 - 其他标
有谁知道 System.Collections.Specialized.StringDictionary 对象和 System.Collections.Generic.Dictionary 之间的实际
我想知道 .NET 是否提供任何标准功能来通过列表或字典对象进行前缀搜索。我遇到了 StringDictionary,但不知道它是否可以为我做到这一点。 如果它可以进行前缀搜索,它是否也可以进行子字符
如果这是一个愚蠢的问题,我深表歉意,但请听我说完: Dictionary genericDict = new Dictionary; genericDict.Add("blah", "bloop");
这个问题在这里已经有了答案: StringDictionary vs Dictionary (7 个答案) 关闭 9 年前。 System.Collections.Specialized 包含 St
我是一名优秀的程序员,十分优秀!