예제 #1
0
        public static bool _ConvertToInvariantString_System_ComponentModel_TypeConverter_System_ComponentModel_ITypeDescriptorContext_System_Object( )
        {
            //class object
            System.ComponentModel.TypeConverter _System_ComponentModel_TypeConverter = new System.ComponentModel.TypeConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.Object _value = null;

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

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

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_TypeConverter.ConvertToInvariantString(context, _value);
            }

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


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_TypeConverter.ConvertToInvariantString(context, _value);
            }

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


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _ConvertToInvariantString_System_ComponentModel_TypeConverter_System_ComponentModel_ITypeDescriptorContext_System_Object( )
        {
            //class object
            System.ComponentModel.TypeConverter _System_ComponentModel_TypeConverter = new System.ComponentModel.TypeConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.Object _value = null;

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

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

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_TypeConverter.ConvertToInvariantString(context,_value);
               }

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

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_TypeConverter.ConvertToInvariantString(context,_value);
               }

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

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
 private object cc(object tipo)
 {
     if (tipo == null)
     {
         return(null);
     }
     if (esConocido(tipo))
     {
         return(tipo);
     }
     else if (tipo is System.Web.UI.Triplet)
     {
         System.Web.UI.Triplet triple = (System.Web.UI.Triplet)tipo;
         return(new seriable3(cc(triple.First), cc(triple.Second), cc(triple.Third)));
     }
     else if (tipo is System.Web.UI.Pair)
     {
         System.Web.UI.Pair par = (System.Web.UI.Pair)tipo;
         return(new seriable2(cc(par.First), cc(par.Second)));
     }
     else if (tipo is ArrayList)
     {
         ArrayList trans  = (ArrayList)tipo;
         ArrayList salida = new ArrayList(trans.Count);
         foreach (object x in trans)
         {
             salida.Add(cc(x));
         }
         return(salida);
     }
     else if (tipo is Array)
     {
         Array trans  = (Array)tipo;
         Array salida = Array.CreateInstance(tipo.GetType().GetElementType(), trans.Length);
         for (int x = 0; x < trans.Length; x++)
         {
             salida.SetValue(cc(trans.GetValue(x)), x);
         }
         return(salida);
     }
     else if (tipo is Hashtable)
     {
         IDictionaryEnumerator enumerator = ((Hashtable)tipo).GetEnumerator();
         Hashtable             salida     = new Hashtable();
         while (enumerator.MoveNext())
         {
             salida.Add(cc(enumerator.Key), cc(enumerator.Value));
         }
         return(salida);
     }
     else
     {
         Type valueType       = tipo.GetType();
         Type destinationType = typeof(string);
         bool flag;
         bool flag2;
         System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(valueType);
         if (((converter == null) || converter is System.ComponentModel.ReferenceConverter))
         {
             flag  = false;
             flag2 = false;
         }
         else
         {
             flag  = converter.CanConvertTo(destinationType);
             flag2 = converter.CanConvertFrom(destinationType);
         }
         if ((flag && flag2))
         {
             return(new generalCnv(valueType, converter.ConvertToInvariantString(tipo)));
         }
         else
         {
             return(tipo);
             //Salida General
         }
     }
 }