<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0-preview.7.24405.7" />

CommaDelimitedStringCollectionConverter

Converts a comma-delimited string value to and from a CommaDelimitedStringCollection object. This class cannot be inherited.
using System.ComponentModel; using System.Globalization; namespace System.Configuration { public sealed class CommaDelimitedStringCollectionConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ConfigurationConverterBase.ValidateType(value, typeof(CommaDelimitedStringCollection)); return (value as CommaDelimitedStringCollection)?.ToString(); } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { CommaDelimitedStringCollection commaDelimitedStringCollection = new CommaDelimitedStringCollection(); commaDelimitedStringCollection.FromString((string)data); return commaDelimitedStringCollection; } } }