我有一个枚举,我想用字典制作一个映射器。
这是我的枚举:
public enum PrintOrderStatus
{
Pending = 1,
Confirmed = 2,
PreparedForPrint = 3,
PreparedForDevlivery = 4,
Delivered = 5,
Canceled = int.MaxValue,
}
这是我的字典:
var map = new Dictionary<PrintOrderStatus, PrintOrderStatus[]>
{
{ PrintOrderStatus.Pending, new[] { PrintOrderStatus.Canceled,
PrintOrderStatus.Confirmed } },
{ PrintOrderStatus.Confirmed, new[] { PrintOrderStatus.PreparedForPrint,
PrintOrderStatus.PreparedForDevlivery } },
{ PrintOrderStatus.PreparedForDevlivery, new[] { PrintOrderStatus.Delivered } },
};
鉴于我的实体的当前状态,我如何才能获得数组中不同键的值?