ConfigurationConverterBase.CanConvertFrom Method (ITypeDescriptorContext, Type)

Determines whether the conversion is allowed.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public:
virtual bool CanConvertFrom (
	ITypeDescriptorContext^ ctx, 
	Type^ type
) override
public boolean CanConvertFrom (
	ITypeDescriptorContext ctx, 
	Type type
)
public override function CanConvertFrom (
	ctx : ITypeDescriptorContext, 
	type : Type
) : boolean
Not applicable.

Parameters

ctx

The ITypeDescriptorContext object used for type conversions.

type

The Type to convert from.

Return Value

true if the conversion is allowed; otherwise, false.

The CanConvertFrom method determines whether a conversion can be performed on strongly typed properties to obtain value strings used in the configuration file.

The following example code shows how to override the CanConvertFrom method to create a custom TimeSpan converter type. Also, the example shows how to use this type in a custom section.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: