小编old*_*vid的帖子

如何使用对象初始化程序在vb.net中创建数组来设置属性

我正在查看http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api上的代码示例

作为一个练习,我试图将它从C#翻译成vb.net但是没有运气这个片段,

    public class Product
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public string Category { get; set; }
            public decimal Price { get; set; }
    }
     Product[] products = new Product[] 
       { new Product { Id = 1, Name = "Tomato Soup", Category = "Groceries", Price = 1 }, 
         new Product { Id = 2, Name = "Yo-yo", Category = "Toys", Price = 3.75M }, 
         new Product { Id …
Run Code Online (Sandbox Code Playgroud)

c# vb.net

2
推荐指数
1
解决办法
850
查看次数

标签 统计

c# ×1

vb.net ×1