public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (null == destinationType)
{
throw ADP.ArgumentNull(nameof(destinationType));
}
if ((typeof(InstanceDescriptor) == destinationType) && (value is DataTableMapping))
{
DataTableMapping mapping = (DataTableMapping)value;
DataColumnMapping[] columnMappings = new DataColumnMapping[mapping.ColumnMappings.Count];
mapping.ColumnMappings.CopyTo(columnMappings, 0);
object[] values = new object[] { mapping.SourceTable, mapping.DataSetTable, columnMappings };
Type[] types = new Type[] { typeof(string), typeof(string), typeof(DataColumnMapping[]) };
ConstructorInfo ctor = typeof(DataTableMapping).GetConstructor(types);
return new InstanceDescriptor(ctor, values);
}
return base.ConvertTo(context, culture, value, destinationType);
}
}