动态更改参数的数据成员名称(在参数名称中包含$)

时间:2018-07-24 18:18:33

标签: c# .net json rest wcf

我有一个问题,我需要从其中包含$的wcf restful服务输出对象。我试过输出字典,但是当序列化为JSON时,$ gets会被编码。我正在与之通信的服务要求对象看起来像这样[{$ name:value}]

是否可以在运行时更改参数的data member属性中的Name?

[DataMember(Name = "RenameMe")]
public string Values { get; set; }
public Variable(string name, string values)
{           
      this.Values = values; 
      [set the name attribute to : "$name"]


}

0 个答案:

没有答案