如何将此模型数据转换为C#类?

问题描述 投票:-2回答:1

是否存在将此模型数据转换为C#的站点?

Data
{
   variableName1 (Array[Type], optional),
   variableName2 (integer, optional),
}
c# model converters
1个回答
0
投票

AFAIK,不,没有网站将数据模型转换为C#代码。

同时,只需查看数据模型,您就可以将其转换为类,例如。

public class Data
{
    //can also be of type object[] sins there is no set element type, not sure what Array[Type] really means
    public Array variableName1;
    public int variableName2;
}

注意:

1)类和结构都不能指定optional字段/属性,只是您使用em还是不使用;

2)在此示例中,我将variables编写为字段,但您也可以将其编写为属性,即Array variableName1 { get; set; }

© www.soinside.com 2019 - 2024. All rights reserved.