public static global::System.Type GetTypeFromHandle(RuntimeTypeHandle TypeHandle) { var e = new __Type { _TypeHandle = TypeHandle }; return((global::System.Type)(object) e); }
// 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); }
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); }
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); }
// 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); }
public bool Equals(__Type e) { return(InternalEquals(this, e)); }