System.Configuration.CommaDelimitedStringCollectionConverter.ConvertTo C# (CSharp) Метод

ConvertTo() публичный Метод

public ConvertTo ( ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type ) : object
ctx ITypeDescriptorContext
ci CultureInfo
value object
type System.Type
Результат object
        public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) {

            ValidateType(value, typeof(CommaDelimitedStringCollection));
            CommaDelimitedStringCollection internalValue = value as CommaDelimitedStringCollection;
            if (internalValue != null) {
                return internalValue.ToString();
            }
            else {
                return null;
            }
        }

Usage Example

		public void ConvertTo ()
		{
			CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter ();
			CommaDelimitedStringCollection col = new CommaDelimitedStringCollection();
			col.Add ("hi");
			col.Add ("bye");

			Assert.AreEqual ("hi,bye", cv.ConvertTo (null, null, col, typeof (string)), "A1");
		}
All Usage Examples Of System.Configuration.CommaDelimitedStringCollectionConverter::ConvertTo
CommaDelimitedStringCollectionConverter