예제 #1
0
 public RuntimeOptionBase this[RuntimeOptions.Identity identity] {
     get {
         identity.EnsureNotNull(nameof(identity));
         //
         try {
             return(_options[key : identity]);
         }
         catch (KeyNotFoundException exception) {
             throw new KeyNotFoundException(message: $"There is not an option with the specified identity.{Environment.NewLine}\tOption identity:{Environment.NewLine}\t\t{identity}", innerException: exception);
         }
     }
 }
예제 #2
0
 public bool TryGetOption(RuntimeOptions.Identity identity, out RuntimeOptionBase option)
 => _options.TryGetValue(key: identity.EnsureNotNull(nameof(identity)).Value, value: out option);