Automatak.Simulator.DNP3.Commons.ProxyCommandHandler.GetOrElse C# (CSharp) Method

GetOrElse() private method

private GetOrElse ( ushort index, CommandStatus>.IDictionary dictionary, Func action ) : CommandStatus
index ushort
dictionary CommandStatus>.IDictionary
action Func
return 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();
            }
        }