Creating a custom type converter part 3: Types to string
How to use a TypeConverter to provide editing of immutable structs that are properties of containing objects via a PropertyGrid.
How to use a TypeConverter to provide editing of immutable structs that are properties of containing objects via a PropertyGrid.
Enums are useful language features. But what happens when you want to display a string version of an enum member rather than just casting the member to a string? You could manually create a switch statement for conversion, and periodically update such functions when extending the source enum. Or you could use the power of reflection and attributes to do it automatically.
This article describes extending a custom `TypeConverter` created previously to support better code generation, expandable properties, and dropdown lists containing standard values.
Type converters allow classes to be edited via designers such as the `PropertyGrid`. This article details how to create a simple type converter to and from a `string` for use with a `PropertyGrid` control.