ArrayConverter.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // System.ComponentModel.ArrayConverter
  3. //
  4. // Authors:
  5. // Martin Willemoes Hansen ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) 2003 Martin Willemoes Hansen
  9. // (C) 2003 Andreas Nahr
  10. //
  11. using System.Globalization;
  12. namespace System.ComponentModel
  13. {
  14. public class ArrayConverter : CollectionConverter
  15. {
  16. public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value,
  17. Type destinationType)
  18. {
  19. if (destinationType == null)
  20. throw new ArgumentNullException ("destinationType");
  21. if (destinationType == typeof (string) && (value is Array))
  22. return "(Array)";
  23. return base.ConvertTo (context, culture, value, destinationType);
  24. }
  25. public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context,
  26. object value, Attribute[] attributes)
  27. {
  28. // LAMESPEC MS seems to always parse an PropertyDescriptorCollection without any PropertyDescriptors
  29. return PropertyDescriptorCollection.Empty;
  30. }
  31. public override bool GetPropertiesSupported (ITypeDescriptorContext context)
  32. {
  33. return true;
  34. }
  35. }
  36. }