示例#1
0
 public static object mkNullable(object obj, global::System.Type nullableType)
 {
     if (nullableType.ContainsGenericParameters)
     {
         return(haxe.lang.Null <object> .ofDynamic <object>(obj));
     }
     return(nullableType.GetMethod("_ofDynamic").Invoke(null, new object[] { obj }));
 }
        // Token: 0x06000580 RID: 1408 RVA: 0x0001B790 File Offset: 0x00019990
        private static void InvokeIfExists(this object objectToCheck, string methodName, params object[] parameters)
        {
            global::System.Type type = objectToCheck.GetType();
            global::System.Reflection.MethodInfo method = type.GetMethod(methodName, 52);
            bool flag = method != null;

            if (flag)
            {
                method.Invoke(objectToCheck, parameters);
            }
        }
示例#3
0
文件: Class.cs 项目: g-pechorin/xmlvm
        public virtual global::System.Object newInstance()
        {
//XMLVM_BEGIN_WRAPPER[java.lang.Class: java.lang.Object newInstance()]
            org.xmlvm._nTIB       tib        = (org.xmlvm._nTIB) this._ftib;
            global::System.Type   nativeType = tib.getNativeType();
            global::System.Object obj        = global::System.Activator.CreateInstance(nativeType);
            global::System.Reflection.MethodInfo jConstructor = nativeType.GetMethod("this", new global::System.Type[] {});
            jConstructor.Invoke(obj, new object[] {});
            return(obj);
//XMLVM_END_WRAPPER[java.lang.Class: java.lang.Object newInstance()]
        }
示例#4
0
 public string ToStringWithCulture(object objectToConvert) {
     if ((objectToConvert == null)) {
         throw new global::System.ArgumentNullException("objectToConvert");
     }
     global::System.Type type = objectToConvert.GetType();
     global::System.Type iConvertibleType = typeof(global::System.IConvertible);
     if (iConvertibleType.IsAssignableFrom(type)) {
         return ((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider);
     }
     global::System.Reflection.MethodInfo methInfo = type.GetMethod("ToString", new global::System.Type[] {
                 iConvertibleType});
     if ((methInfo != null)) {
         return ((string)(methInfo.Invoke(objectToConvert, new object[] {
                     this.formatProvider})));
     }
     return objectToConvert.ToString();
 }
示例#5
0
    /// <summary>
    /// This is called from the compile/run appdomain to convert objects within an expression block to a string
    /// </summary>
    public static string ToStringWithCulture(object objectToConvert)
    {
        if ((objectToConvert == null))
        {
            throw new global::System.ArgumentNullException("objectToConvert");
        }

        global::System.Type t = objectToConvert.GetType();
        global::System.Reflection.MethodInfo method = t.GetMethod("ToString", new global::System.Type[] {
            typeof(global::System.IFormatProvider)
        });
        if ((method == null))
        {
            return(objectToConvert.ToString());
        }
        else
        {
            return((string)(method.Invoke(objectToConvert, new object[] { formatProviderField })));
        }
    }