ConvertTo() public method

Converts the given value object to the specified type, using the specified context and culture information.
public ConvertTo ( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType ) : object
context ITypeDescriptorContext /// A /// that provides a format context. ///
culture System.Globalization.CultureInfo /// The to use /// as the current culture. ///
value object /// The value that is to be converted. ///
destinationType System.Type /// The to convert the /// parameter to. ///
return object
 public void ConvertToString () 
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
     object foo = cnv.ConvertTo (typeof (string), typeof (string));
     Assert.IsNotNull (foo);
     Assert.AreEqual (typeof (string).AssemblyQualifiedName, foo);
 }
Beispiel #2
0
        public void ConvertToString()
        {
            RuntimeTypeConverter cnv = new RuntimeTypeConverter();
            object foo = cnv.ConvertTo(typeof(string), typeof(string));

            Assert.IsNotNull(foo);
            Assert.AreEqual(typeof(string).AssemblyQualifiedName, foo);
        }
 public void ConvertToStringFromNonSupportedType () 
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
     object foo = cnv.ConvertTo (typeof (string), GetType ());
 }
Beispiel #4
0
 public void ConvertToStringFromNonSupportedType()
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter();
     object foo = cnv.ConvertTo(typeof(string), GetType());
 }
Beispiel #5
0
        public void ConvertToStringFromNonSupportedType()
        {
            RuntimeTypeConverter cnv = new RuntimeTypeConverter();

            Assert.Throws <NotSupportedException>(() => cnv.ConvertTo(typeof(string), GetType()));
        }
 public void ConvertToStringFromNonSupportedType ()
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
     Assert.Throws<NotSupportedException>(() => cnv.ConvertTo (typeof (string), GetType ()));
 }