如何将以下 C# 代码转换为 VB.NET?
转换工具做得不好。
private static readonly Dictionary<string, List<string>> ValidHtmlTags = new Dictionary<string, List<string>> {
{ "param", new List<string>() {"name","value"}},
{ "object", new List<string>() {"id","type"}},
{ "embed", new List<string>() {"src","type","wmode"}}
};
最佳答案
我认为答案是 VB.NET 3.5 不支持集合初始化语法。
VB.NET in .NET 4 does support collection initializers如下:
Dim days = New Dictionary(Of Integer, String) From
{{0, "Sunday"}, {1, "Monday"}}
前面的代码示例等同于下面的代码。
Dim days = New Dictionary(Of Integer, String)
days.Add(0, "Sunday")
days.Add(1, "Monday")
关于c# - 将此 C# 字典转换为 VB.NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1982794/