ConvertFrom() public méthode

Converts the given value to the type of this converter.
public ConvertFrom ( ITypeDescriptorContext context, CultureInfo culture, object value ) : 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. ///
Résultat object
 public void ConvertFromString () 
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
     object foo = cnv.ConvertFrom ("System.String");
     Assert.IsNotNull (foo);
     Assert.AreEqual (this.GetType().GetType().FullName, foo.GetType ().FullName);
 }
Exemple #2
0
        public void ConvertFromString()
        {
            RuntimeTypeConverter cnv = new RuntimeTypeConverter();
            object foo = cnv.ConvertFrom("System.String");

            Assert.IsNotNull(foo);
            Assert.AreEqual(this.GetType().GetType().FullName, foo.GetType().FullName);
        }
 public void ConvertFromNonSupportedType () 
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
     object foo = cnv.ConvertFrom (12);
 }
Exemple #4
0
 public void ConvertFromNonSupportedType()
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter();
     object foo = cnv.ConvertFrom(12);
 }
Exemple #5
0
        public void ConvertFromNonSupportedType()
        {
            RuntimeTypeConverter cnv = new RuntimeTypeConverter();

            Assert.Throws <NotSupportedException>(() => cnv.ConvertFrom(12));
        }
 public void ConvertFromNonSupportedType ()
 {
     RuntimeTypeConverter cnv = new RuntimeTypeConverter ();
     Assert.Throws<NotSupportedException>(() => cnv.ConvertFrom (12));
 }