ExpandableObjectConverter Class
Provides a type converter to convert expandable objects to and from various other representations.
For a list of all members of this type, see ExpandableObjectConverter Members.
System.Object
System.ComponentModel.TypeConverter
System.ComponentModel.ExpandableObjectConverter
System.Drawing.IconConverter
System.Drawing.Printing.MarginsConverter
System.Windows.Forms.ListViewItemConverter
[Visual Basic] Public Class ExpandableObjectConverter Inherits TypeConverter [C#] public class ExpandableObjectConverter : TypeConverter [C++] public __gc class ExpandableObjectConverter : public TypeConverter [JScript] public class ExpandableObjectConverter extends TypeConverter
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
This class adds support for properties on an object to the methods and properties provided by TypeConverter. To make a type of property expandable in the PropertyGrid, specify this TypeConverter for standard implementations of GetPropertiesSupported and GetProperties.
Note You should never access a type converter directly. Instead, call the appropriate converter by using TypeDescriptor. For more information, see the examples in the TypeConverter base class.
For more information about type converters, see the TypeConverter base class and Implementing a Type Converter.
Example
[Visual Basic, C#, C++] The following example converts a variable of type Margins to a string variable.
[Visual Basic] Dim strM As String strM = "1,2,3,4" Dim m = New System.Drawing.Printing.Margins(1, 2, 3, 4) Console.WriteLine(TypeDescriptor.GetConverter(strM).CanConvertTo(GetType(System.Drawing.Printing.Margins))) Console.WriteLine(TypeDescriptor.GetConverter(m).ConvertToString(m)) [C#] string strM="1,2,3,4"; System.Drawing.Printing.Margins m= new System.Drawing.Printing.Margins(1,2,3,4); Console.WriteLine(TypeDescriptor.GetConverter(strM).CanConvertTo(typeof(System.Drawing.Printing.Margins))); Console.WriteLine(TypeDescriptor.GetConverter(m).ConvertToString(m)); [C++] String* strM = S"1,2,3,4"; System::Drawing::Printing::Margins* m = new System::Drawing::Printing::Margins(1,2,3,4); Console::WriteLine(TypeDescriptor::GetConverter(strM)->CanConvertTo(__typeof(System::Drawing::Printing::Margins))); Console::WriteLine(TypeDescriptor::GetConverter(m)->ConvertToString(m));
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.ComponentModel
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)
See Also
ExpandableObjectConverter Members | System.ComponentModel Namespace