我想达到与使用此语法在 C# 中获得的结果相同的结果,但在 VB.NET 中:
// This is my generic object (coming from Json parsing!):
var genericContent = new { Name = "name1", Value = 0 };
// I would like to have a generic list, created by this generic item:
var myList = (new[] { genericContent }).ToList();
// So, I can add any other generic items (with the same structure)...
myList.Add(new { Name = "name2", Value = 1 });
// And treat them as a normal list, without declaring the class!
return myList.Count;
...所以,我只想在 VB 中创建一个通用数组。
在 C# 中它运行良好,但我不知道这种 VB.NET 语法......
我正在使用 .NET 框架 3.5!
谢谢!