public TypeConverter GetConverter() {
if (converter == null) {
TypeConverterAttribute attr = (TypeConverterAttribute)GetAttributes(null)[typeof(TypeConverterAttribute)];
if (attr != null) {
Type converterType = GetTypeFromName(attr.ConverterTypeName);
if (converterType != null && typeof(TypeConverter).IsAssignableFrom(converterType)) {
converter = (TypeConverter)CreateInstance(converterType);
}
}
if (converter == null) {
// We did not get a converter. Traverse up the base class chain until
// we find one in the stock hashtable.
//
converter = (TypeConverter)SearchIntrinsicTable(IntrinsicTypeConverters);
Debug.Assert(converter != null, "There is no intrinsic setup in the hashtable for the Object type");
}
}
return converter;
}