以下是测试代码
var DesignAlterGuid = "1";
var ydgcxtSubContractGuid = "2";
var AlterCode = "3";
//new object 中默认有个语法糖规则就是,如果没有定义属性名,属性值的名称就是属性名
var obj = new
{
DesignAlterGuid,
ydgcxtSubContractGuid,
AlterCode
};
//先转换为json在转为字典对象
var response = JsonConvert.DeserializeObject<IDictionary<string, object>>(JsonConvert.SerializeObject(obj));
var newobj = new
{
DesignAlterGuid = response["DesignAlterGuid"],
ydgcxtSubContractGuid = response["ydgcxtSubContractGuid"],
AlterCode = response["AlterCode"],
newtest = "4"
};
代码监视截图
结果图