こんにちは、以下のコードの目的は、関連するデータセットを保持する静的クラスを返すことです。私がこれをより良くする方法をお勧めできますか?
public class People
{
//want info to be setup in this class, so it can be accessed elsewhere
public static readonly string[] ab = { "ALBERT", "EINSTEIN"};
public static readonly string[] dk = { "DONALD", "KNUTH" };
//is this efficient or instantiated once per access? IF SO HOW CAN I DO THIS BETTER?
public static readonly Info AB = new Info(ab, 100);
public static readonly Info DK = new Info(dk, 80);
}
public class Info
{
private string[] _name;
private int _age;
public string[] Name { get{ return _name}; }
public int Age { get { return _age; } }
public Info(string[] n, int a)
{
_name = n;
_age = a;
}
}