ValidateValueAsArray method

void ValidateValueAsArray(
  1. Object? value
)
Converts a String to value consistent with type (or uses the default value if the String is null or empty). String to convert to a value. Validates array value. The value.

Implementation

//        object ConvertToValueOrDefault(String stringValue)
//        {
//            return StringUtils.IsNullOrEmpty(stringValue) ? this.DefaultValue : this.ConvertToValue(stringValue);
//        }

/// <summary>
/// Validates array value.
/// </summary>
/// <param name="value">The value.</param>
void ValidateValueAsArray(Object? value) {
  if (value == null) {
    throw new ArgumentNullException("value");
  }

  if (value is List) {
    if (value.isEmpty) {
      ArgumentException("The Array value must have at least one element.");
    }
    if (value.first.runtimeType != this.Type) {
      throw new ArgumentException(
          "Type ${value.runtimeType} can't be used as an array of type ${this.Type}.");
    }
  }
}