mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Refactor
This commit is contained in:
@@ -21,17 +21,10 @@ namespace CliFx.Schema
|
||||
|
||||
public IReadOnlyList<object?> GetValidValues()
|
||||
{
|
||||
Type typeToCheck = Type;
|
||||
foreach (var inf in typeToCheck.GetInterfaces())
|
||||
{
|
||||
if (inf.IsGenericType && inf.GetGenericTypeDefinition() == typeof(IEnumerable<>))
|
||||
{
|
||||
typeToCheck = inf.GenericTypeArguments[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var underlyingType = typeToCheck.TryGetNullableUnderlyingType() ?? typeToCheck;
|
||||
var underlyingType =
|
||||
Type.TryGetNullableUnderlyingType() ??
|
||||
Type.TryGetEnumerableUnderlyingType() ??
|
||||
Type;
|
||||
|
||||
// We can only get valid values for enums
|
||||
if (underlyingType.IsEnum)
|
||||
|
||||
Reference in New Issue
Block a user