0

How could I do this in c # var John = { name: "John", age: 25 }; var James = { name: "James", age: 21 };

16th Feb 2021, 4:26 PM
Harold SKRT🤘🤘🤘
Harold SKRT🤘🤘🤘 - avatar
4 Answers
+ 6
Harold SKRT🤘🤘🤘 , the way of doing this depends on what you want to achieve. can you give us some explanations? thanks!
16th Feb 2021, 4:55 PM
Lothar
Lothar - avatar
+ 2
I think, smth like: Dictionary<string, string> John = new Dictionary<string, string>(); John.Add("name", "John"); John.Add("age", "25"); Dictionary<string, string> James = new Dictionary<string, string>(); James.Add("name", "James"); James.Add("age", "21");
16th Feb 2021, 4:36 PM
Nazeekk
Nazeekk - avatar
+ 1
Var person = new {name = "jhon",age = 25}; Consola.Write(person.name);
16th Feb 2021, 4:51 PM
Harold SKRT🤘🤘🤘
Harold SKRT🤘🤘🤘 - avatar
+ 1
It will help you may be: struct John { public string name; public int age; public John(string name, int age) { this.name = name; this.age = age; } } struct James { public string name; public int age; public James(string name, int age) { this.name = name; this.age = age; } } //Main John john = new John("John", 25); James james = new James("James", 21);
17th Feb 2021, 3:14 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar