コード例 #1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (value == null)
                {
                    value = new StringCollection();
                }

                ArrayListConverter <string> conv = new ArrayListConverter <string>();

                return(conv.ConvertToString(value));
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
コード例 #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                ArrayListConverter <string> conv = new ArrayListConverter <string>();

                ArrayList        al         = (ArrayList)conv.ConvertFrom(value);
                StringCollection collection = new StringCollection();

                foreach (string s in al)
                {
                    collection.Add(s);
                }

                return(collection);
            }

            return(base.ConvertFrom(context, culture, value));
        }