public override async Task <TypeConverterResult> ReadAsync(IInteractionContext context, IComponentInteractionData option, IServiceProvider services) { var results = new List <TypeConverterResult>(); foreach (var value in option.Values) { var result = await _typeReader.ReadAsync(context, value, services).ConfigureAwait(false); if (!result.IsSuccess) { return(result); } results.Add(result); } var destination = Array.CreateInstance(_underlyingType, results.Count); for (var i = 0; i < results.Count; i++) { destination.SetValue(results[i].Value, i); } return(TypeConverterResult.FromSuccess(destination)); }
public override Task <TypeConverterResult> ReadAsync(IInteractionContext context, string option, IServiceProvider services) => string.IsNullOrEmpty(option) ? Task.FromResult(TypeConverterResult.FromSuccess(null)) : _typeReader.ReadAsync(context, option, services);