views:

16

answers:

0

I have a TypeConverter on the base class in my project.

[TypeConverter(typeof(CodeTypeConverter))]
abstract class CodeBase

I have a number of classes which inherit this base

class TitleCode : CodeBase
class PreferenceCode : CodeBase

When the thing that calls the type converter (ValueProvider.ConvertSimpleType) it does not create a context and so ConvertFrom is not informed of the destination type, so it can do the conversion.

public override object ConvertFrom(
  ITypeDescriptorContext context, // this is null
  CultureInfo culture,
  object value)

Has anyone come across this problem? And, if so, do you have a work around?