を一覧表示する辞書<文字列、オブジェクト>を変換するためにはどうすればUser
クラスは<T>
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
とDictionary
public Dictionary<string, object> models = new Dictionary<string, object>
{
{"Users[0].Id", 1},
{"Users[0].Name", "Rajib"},
{"Users[0].Email", "[email protected]"},
{"Users[1].Id", 2},
{"Users[1].Name", "Ashiq"},
{"Users[1].Email", "[email protected]"},
{"Users[2].Id", 3},
{"Users[2].Name", "Zaman"},
{"Users[2].Email", "[email protected]"},
};
は今、私はList<User>
にDictionary<string, object> models
の値を変換する必要があります。 誰も私にそのことを提案することはできますか?
'" Users [0] .Id "'。それは実際には 'Dictionary'の文字列値ですか? –
はい。これは実際には文字列値です@NikhilAgrawal – Ashiquzzaman
あなたのシナリオでは、C#コードスニペット/式(例: "Users [0] .Id"など)の文字列の使用は非常に奇妙です。あなたは本当に最初にそのような辞書を使用する必要がありますか? – elgonzo