Use better code
This commit is contained in:
parent
608e7a99bc
commit
75c8a8ced4
32 changed files with 77 additions and 105 deletions
|
|
@ -147,12 +147,11 @@ namespace TShockAPI.CLI
|
|||
/// <returns></returns>
|
||||
public T Get<T>(FlagSet flags)
|
||||
{
|
||||
if (!_results.ContainsKey(flags))
|
||||
if (!_results.TryGetValue(flags, out object result))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
|
||||
object result = _results[flags];
|
||||
Type t = typeof(T);
|
||||
|
||||
if (t == typeof(string))
|
||||
|
|
|
|||
|
|
@ -43,10 +43,7 @@ namespace TShockAPI.CLI
|
|||
/// <param name="flags">Flags represented by this FlagSet</param>
|
||||
public FlagSet(params string[] flags)
|
||||
{
|
||||
if (flags == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(flags));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(flags);
|
||||
|
||||
_flags = flags.Select(f => f.ToLowerInvariant());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue