Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Unit
- {
- public string Year { get; set; }
- public string Model { get; set; }
- }
- {
- "UnitYear":"2018",
- "UnitModel":"F250 Super Duty"
- }
- {
- "AssetYear":"2019",
- "AssetModel":"Corvette Stingray"
- }
- Unit1 : Year = 2018, Model = F250 Super Duty
- Unit2 : Year = 2019, Model = Corvette Stingray
- private static Dictionary<string, List<KeyValuePair<string, string>>> Units = new Dictionary<string, List<KeyValuePair<string,string>>>
- {
- { "0000001", new List<KeyValuePair<string,string>>
- {
- new KeyValuePair<string,string>("Year", "UnitYear"),
- new KeyValuePair<string,string>("Model", "UnitModel")
- }
- },
- { "0000002", new List<KeyValuePair<string,string>>
- {
- new KeyValuePair<string,string>("Year", "AssetYear"),
- new KeyValuePair<string,string>("Model", "AssetModel")
- }
- },
- };
- Unit u1 = JsonConvert.DeserializeObject<Unit>(json, new GenericConverter("0000001"));
- Unit u2 = JsonConvert.DeserializeObject<Unit>(json, new GenericConverter("0000002"));
Add Comment
Please, Sign In to add comment