private readonly Dictionary<ExcelCellIdentifier, int> allInfoByIdentifier = new Dictionary<ExcelCellIdentifier, int>();
public class ExcelCellIdentifier
{
public ExcelCellIdentifier(string ticker, string identifier)
{
Ticker = ticker;
Identifier = identifier;
}
public string Ticker { get; set; }
public string Identifier { get; set; }
}
然后在某个时候,我想通过创建一个具有相同代码和标识符的 ExcelCellIdentifier 对象来搜索 int,例如:
ExcelCellIdentifier ex = new ExcelCellIdentifier("Ticker1", "Identifier1");
int a = allInfoByIdentifier[ex];
//a is a value stored before hand
这可能吗?