private GetOrElse ( ushort index, CommandStatus>.IDictionary |
||
index | ushort | |
dictionary | CommandStatus>.IDictionary | |
action | Func |
|
Результат | CommandStatus |
CommandStatus GetOrElse(ushort index, IDictionary<UInt16, CommandStatus> dictionary, Func<CommandStatus> action)
{
if (enabled)
{
CommandStatus status;
if (dictionary.TryGetValue(index, out status))
{
return status;
}
else
{
return action.Invoke();
}
}
else
{
return action.Invoke();
}
}