Anonymous class initialization in VB.Net

后端 未结 2 1662
余生分开走
余生分开走 2021-02-13 22:05

i want to create an anonymous class in vb.net exactly like this:

var data = new {
                total = totalPages,
                page = page,
                      


        
2条回答
  •  萌比男神i
    2021-02-13 22:58

    In VS2010:

    Dim jsonData = New With {
      .total = 1,
      .page = Page,
      .records = 3,
      .rows = {
        New With {.id = 1, .cell = {"1", "-7", "Is this a good question?"}},
        New With {.id = 2, .cell = {"2", "15", "Is this a blatant ripoff?"}},
        New With {.id = 3, .cell = {"3", "23", "Why is the sky blue?"}}
      }
    }
    

提交回复
热议问题