生成VB.NET类 [英] Generating Class VB.NET

查看:123
本文介绍了生成VB.NET类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 JSON Utils 生成一个类,但遇到了问题.我正在使用的JSON字符串:

I was using JSON Utils to generate a Class and I came to a problem. The JSON string I'm using:

{
  "type": "champion",
  "version": "7.16.1",
  "data": {
    "1": {
      "title": "the Dark Child",
      "id": 1,
      "key": "Annie",
      "name": "Annie"
    }
  }
}

它生成的类:

Public Class 1
    Public Property title As String
    Public Property id As Integer
    Public Property key As String
    Public Property name As String
End Class

Public Class Data
    Public Property 1 As 1
End Class

Public Class Example
    Public Property type As String
    Public Property version As String
    Public Property data As Data
End Class

问题是我无法命名为Class 1,我仍在尝试寻找解决方案,但还没有运气.有没有解决的办法?

The thing is that I cannot name a Class 1, I am still trying to find a solution but with no luck yet. Is there a work around this?

推荐答案

我认为应该将其更改为Dictionary

I think it should be change to Dictionary

Public Class Example
    Public Property type As String
    Public Property version As String
    Public Property data As Dictionary(Of String, NumberType)
End Class

Public Class NumberType
    Public Property title As String
    Public Property id As Integer
    Public Property key As String
    Public Property name As String
End Class

这篇关于生成VB.NET类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆