コード例 #1
0
ファイル: Type.cs プロジェクト: wclwksn/code
        public static global::System.Type GetTypeFromHandle(RuntimeTypeHandle TypeHandle)
        {
            var e = new __Type
            {
                _TypeHandle = TypeHandle
            };

            return((global::System.Type)(object) e);
        }
コード例 #2
0
ファイル: Activator.cs プロジェクト: wclwksn/code
        // tested by
        // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestAndroidOrderByThenGroupBy\ApplicationWebService.cs

        public static object CreateInstance(Type type)
        {
            __Type t = type;
            var    o = default(object);

            try
            {
                o = t.InternalTypeDescription.newInstance();
            }
            catch      // (csharp.ThrowableException e)
            {
                throw; // new csharp.RuntimeException(e.ToString());
            }

            return(o);
        }
コード例 #3
0
        public static Array CreateInstance(Type elementType, int length)
        {
            // X:\jsc.svn\examples\java\async\Test\JVMCLRAsync\JVMCLRAsync\Program.cs

            __Type t = elementType;
            var    o = default(Array);

            try
            {
                o = (Array)java.lang.reflect.Array.newInstance(t.InternalTypeDescription, length);
            }
            catch
            {
                throw;
            }

            return(o);
        }
コード例 #4
0
ファイル: Type.cs プロジェクト: wclwksn/code
        private static bool InternalEquals(__Type e, __Type k)
        {
            // X:\jsc.svn\examples\java\hybrid\Test\JVMCLRTypeOfBool\JVMCLRTypeOfBool\Program.cs

            #region null checks
            var oleft  = (object)e;
            var oright = (object)k;

            if (oleft == null)
            {
                if (oright == null)
                {
                    return(true);
                }

                return(false);
            }
            else
            {
                if (oright == null)
                {
                    return(false);
                }
            }
            #endregion

            // c# typeof is not using primitves, so upgrade for check
            if (e.InternalTypeDescription == java.lang.Boolean.TYPE)
            {
                e = typeof(bool);
            }
            if (k.InternalTypeDescription == java.lang.Boolean.TYPE)
            {
                k = typeof(bool);
            }

            // .net 4.0 seems to also add == operator. jsc should choose equals until then?
            if (k.InternalTypeDescription.isAssignableFrom(e.InternalTypeDescription))
            {
                return(k.FullName == e.FullName);
            }

            return(false);
        }
コード例 #5
0
        // tested by
        // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestAndroidOrderByThenGroupBy\ApplicationWebService.cs

        public static object CreateInstance(Type type)
        {
            // X:\jsc.svn\core\ScriptCoreLibJava\java\io\FileDescriptor.cs
            // X:\jsc.svn\core\ScriptCoreLibAndroid\ScriptCoreLibAndroid\android\os\MemoryFile.cs

            __Type t = type;
            var    o = default(object);

            try
            {
                o = t.InternalTypeDescription.newInstance();
            }
            catch      // (csharp.ThrowableException e)
            {
                throw; // new csharp.RuntimeException(e.ToString());
            }

            return(o);
        }
コード例 #6
0
ファイル: Type.cs プロジェクト: wclwksn/code
 public bool Equals(__Type e)
 {
     return(InternalEquals(this, e));
 }