c#设置字符串数组的模型

时间:2017-03-04 12:25:35

标签: c# arrays string model

我创建了以下模型

public class ListLavorationCodeClient
{
    public string LavorationsCode { get; set; }
}

在我的代码中,我写道:

var listLavorationsCode = new ListLavorationCodeClient()
{
    LavorationsCode =  codiceLavorazioneXx 
};

,结果如下:

{
    "LavorationsCode": "30410040136042700157"
}
{
    "LavorationsCode": "30440040136042700157"
}

相反,我想要一个这样的结果:

{
   "LavorationCode": { "30410040136042700157", "30440040136042700157" }
}

我该如何解决?

1 个答案:

答案 0 :(得分:0)

您需要更改变量本身:

public string[] LavorationsCode { get; set; }