If I interpret your question correctly, you have your own type, call it CustomSetting , and you will have a parameter in your Settings.settings file of this type and specify the default value for this parameter using app.config or the Visual Studio settings user interface.
If this is what you want to do, you need to provide a TypeConverter for your type, which can convert from a string, for example:
[TypeConverter(typeof(CustomSettingConverter))] public class CustomSetting { public string Foo { get; set; } public string Bar { get; set; } public override string ToString() { return string.Format("{0};{1}", Foo, Bar); } } public class CustomSettingConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if( sourceType == typeof(string) ) return true; else return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { string stringValue = value as string; if( stringValue != null ) {
Some background information
TypeConverter is behind the great magic of string conversion in the .Net infrastructure. This is not only useful for customization, but also how Windows Forms and Component designers convert values from the property grid to their target types and how XAML converts attribute values. Many frame types have custom TypeConverter classes, including all primitive types, but also types such as System.Drawing.Size or System.Windows.Thickness and many, many others.
Using TypeConverter from your own code is very simple, all you need to do is the following:
TypeConverter converter = TypeDescriptor.GetConverter(typeof(TargetType)); if( converter != null && converter.CanConvertFrom(typeof(SourceType)) ) targetValue = (TargetType)converter.ConvertFrom(sourceValue);
Source types are supported, but string is the most common. This is a much more powerful (and, unfortunately, less well-known) way to convert values from strings than the ubiquitous, but less flexible Convert class (which only supports primitive types).