creating multiple dictionary and appending into list using c#
问题 I am new to C# and am trying to create something like this using c#. How we can do that any suggestion. I just want to create list of dict. a = [ { "server": "10.14.13.1", "prefer": "Yes" }, { "server": "10.1.2.1", "prefer": "No" } ] 回答1: public class POCO { [JsonProperty("server")] public string Server { get; set; } [JsonProperty("prefer")] public string Prefer { get; set; } } POCO o1 = new POCO("10.1.2.1", "No"); POCO o2 = new POCO("10.1.2.2", "YES"); List<POCO> list = new List<POCO>() {o1,