


All type converters are inherited from the TypeConverter base class provided by. Type converters allow you to convert from your type to another type and also form another type back to your type. You can not store complex types in state view unless it is marked serializable or has its own type converter associated. So whenever possible avoid binary serialization which uses reflection. Type converters provide a better performance than reflection. The state view framework provided by web controls and web forms also relies on type converters. The designer itself uses type converters to convert a property from your type to a string and again from a string back to your type. You can add new properties to a control or modify existing ones. You can also switch to the source mode and then edit the tags itself. The designer creates the necessary form tags and properties. This allows you to place new controls onto the web form and modify their properties. You can also design web forms through the Visual Studio. Any changes the user makes to the property in the property browser is written back to the property, which again uses the type converter to convert from a string back to the type. The property browser finds the type of the property and then the type converter associated with that type to convert the type to a string. Web controls and web forms have properties which you can view and edit through the property browser of the Visual Studio. Type converters are mostly used to convert your type to a string or a string back to your type. This article will explain how you can write your own type converter and then assign that to your own type. But when you create your own complex types then you need to create your own type converters. NET framework comes with a number of type converters which perform all that work for you for the most common. As the name already states, type converters are used to convert from one type to another, for example an integer to a string. NET designer or used the view state architecture of ASP.NET you have relied on the help of a type converter.
Colorconverter canconvertfrom example windows#
But any time you developed a web form or Windows form using the Visual Studio. You may not have written yet your own type converter.
