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)
{
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;
}
}
}