使用
C# Dictionary
保存Person对象:
// Define a class to hold the name and age
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
// Then in your method or constructor
var data = new Dictionary<string, Dictionary<int, Person>>();
// Initialize the inner dictionary for the date "09/10/2023"
data["09/10/2023"] = new Dictionary<int, Person>();
// Add the persons
data["09/10/2023"][10] = new Person { Name = "John Smith", Age = 50 };
data["09/10/2023"][11] = new Person { Name = "Amie Kim", Age = 30 };