-2
我需要一個DTO對象類轉換是這樣的:轉換複雜對象字典<字符串,字符串>
public class ComplexDto
{
public ComplexDto()
{
ListIds = new List<ListIdsDto>();
}
public string Propertie1 { get; set; }
public string Propertie2 { get; set; }
public IList<int> ListIds { get; set; }
}
到dictionary<string,string>
。
這僅僅是一些類的例子,這個類將被用作JSON對象是這樣的:
{"Propertie1":"ss","Propertie2":"","ListIds":[1,2,3]}
我需要此對象傳遞給一個FormUrlEncodedContent(字典)作爲字符串的詞典。
我有這樣的:
var data = new Dictionary<string, string>();
data[string.Empty] = ComplexDto.ToJson();
而且我想到ComplexDto.ToJson()或ComplexDto對象變換爲詞典字符串,字符串。
任何想法?
什麼是ListIdsDto?也只有一個類,你想用於字典的集合在哪裏? – 2014-10-29 10:24:16
什麼是應該轉換爲什麼? – 2014-10-29 10:24:20
你究竟希望'ComplexDto'看起來像一個字符串? – 2014-10-29 10:25:16