implementation and fixes by Andreas Nahr.
[mono.git] / mcs / class / System / System.ComponentModel / CollectionConverter.cs
1 //
2 // System.ComponentModel.CollectionConverter
3 //
4 // Authors:
5 //  Martin Willemoes Hansen (mwh@sysrq.dk)
6 //  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
7 //
8 // (C) 2003 Martin Willemoes Hansen
9 // (C) 2003 Andreas Nahr
10 //
11
12 using System.Collections;
13 using System.Globalization;
14
15 namespace System.ComponentModel
16 {
17         public class CollectionConverter : TypeConverter
18         {
19
20                 public CollectionConverter()
21                 {
22                 }
23
24                 public override object ConvertTo (ITypeDescriptorContext context,
25                                                   CultureInfo culture, object value, Type destinationType)
26                 {
27                         if (destinationType == typeof (string))
28                         if (value != null && (value is ICollection))
29                                 return "(Collection)";
30
31                         return base.ConvertTo (context, culture, value, destinationType);
32                 }
33
34                 public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context,
35                                                                             object value, Attribute[] attributes)
36                 {
37                         return null;
38                 }
39
40                 public override bool GetPropertiesSupported (ITypeDescriptorContext context)
41                 {
42                         return false;
43                 }
44         }
45 }
46