OpacityConverter.CanConvertFrom Method (ITypeDescriptorContext, Type)

 

Returns a value indicating whether this converter can convert an object of the specified source type to the native type of the converter that uses the specified context.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public override bool CanConvertFrom(
	ITypeDescriptorContext context,
	Type sourceType
)

Parameters

context
Type: System.ComponentModel.ITypeDescriptorContext

A ITypeDescriptorContext that provides information about the context of a type converter.

sourceType
Type: System.Type

The Type that represents the type you want to convert from.

Return Value

Type: System.Boolean

true if this converter can perform the conversion; otherwise, false.

The sourceType is expected to be a String.

Notes to Inheritors:

Override this method to provide your own conversion requirements.

You can use the context parameter to extract additional information about the environment this converter is being invoked from. The parameter may be null, so you should always verify the contents. Also, properties on the ITypeDescriptorContext may also return null.

.NET Framework
Available since 1.1
Return to top
Show: