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

WhiteSpaceTrimStringConverter

Converts a string to its canonical format.
using System.ComponentModel; using System.Globalization; namespace System.Configuration { public sealed class WhiteSpaceTrimStringConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ConfigurationConverterBase.ValidateType(value, typeof(string)); if (value != null) return ((string)value).Trim(); return string.Empty; } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { return ((string)data).Trim(); } } }