コード例 #1
0
        public static bool _ConvertFromInvariantString_System_ComponentModel_TypeConverter_System_ComponentModel_ITypeDescriptorContext_System_String( )
        {
            //class object
            System.ComponentModel.TypeConverter _System_ComponentModel_TypeConverter = new System.ComponentModel.TypeConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.String text = null;

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_TypeConverter.ConvertFromInvariantString(context, text);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_TypeConverter.ConvertFromInvariantString(context, text);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
コード例 #2
0
 private object cc2(object tipo)
 {
     if (tipo == null)
     {
         return(null);
     }
     if (tipo is seriable3)
     {
         seriable3 trans = (seriable3)tipo;
         return(new System.Web.UI.Triplet(cc2(trans.First), cc2(trans.Second), cc2(trans.Third)));
     }
     else if (tipo is seriable2)
     {
         seriable2 trans = (seriable2)tipo;
         return(new System.Web.UI.Pair(cc2(trans.First), cc2(trans.Second)));
     }
     else if (tipo is ArrayList)
     {
         ArrayList salida = (ArrayList)tipo;
         for (int x = 0; x < salida.Count; x++)
         {
             salida[x] = cc2(salida[x]);
         }
         return(salida);
     }
     else if (tipo is Array)
     {
         Array salida = (Array)tipo;
         for (int x = 0; x < salida.Length; x++)
         {
             salida.SetValue(cc2(salida.GetValue(x)), x);
         }
         return(salida);
     }
     else if (tipo is Hashtable)
     {
         IDictionaryEnumerator enumerator = ((Hashtable)tipo).GetEnumerator();
         Hashtable             salida     = new Hashtable();
         while (enumerator.MoveNext())
         {
             salida.Add(cc2(enumerator.Key), cc2(enumerator.Value));
         }
         return(salida);
     }
     else if (tipo is generalCnv)
     {
         generalCnv datos = (generalCnv)tipo;
         System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(datos.bTipo);
         return(converter.ConvertFromInvariantString(datos.bString));
     }
     else
     {
         return(tipo);
         //Salida General
     }
 }
        public static bool _ConvertFromInvariantString_System_ComponentModel_TypeConverter_System_ComponentModel_ITypeDescriptorContext_System_String( )
        {
            //class object
            System.ComponentModel.TypeConverter _System_ComponentModel_TypeConverter = new System.ComponentModel.TypeConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.String text = null;

               //ReturnType/Value
               System.Object returnVal_Real = null;
               System.Object returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_TypeConverter.ConvertFromInvariantString(context,text);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_TypeConverter.ConvertFromInvariantString(context,text);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
コード例 #4
0
 private static T GetTFromString <T>(string myString)
 {
     System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(T));
     return((T)(converter.ConvertFromInvariantString(myString)));
 }