IMDTokenProvider Create_SystemArray_get_Length()
		{
			if (Create_SystemArray_get_Length_result_initd)
				return Create_SystemArray_get_Length_result;
			Create_SystemArray_get_Length_result_initd = true;

			var module = GetModule();
			if (module == null)
				return null;

			const string propName = "Length";
			var type = module.CorLibTypes.GetTypeRef("System", "Array");
			var retType = module.CorLibTypes.Int32;
			var mr = new MemberRefUser(module, "get_" + propName, MethodSig.CreateInstance(retType), type);
			Create_SystemArray_get_Length_result = mr;
			var md = mr.ResolveMethod();
			if (md == null || md.DeclaringType == null)
				return mr;
			var prop = md.DeclaringType.FindProperty(propName);
			if (prop == null)
				return mr;

			Create_SystemArray_get_Length_result = prop;
			return prop;
		}
Example #2
0
		IMDTokenProvider Create_SystemType_get_TypeHandle()
		{
			if (Create_SystemType_get_TypeHandle_initd)
				return Create_SystemType_get_TypeHandle_result;
			Create_SystemType_get_TypeHandle_initd = true;

			const string propName = "TypeHandle";
			var type = corLib.GetTypeRef("System", "Type");
			var retType = new ValueTypeSig(corLib.GetTypeRef("System", "RuntimeTypeHandle"));
			var mr = new MemberRefUser(methodDef.Module, "get_" + propName, MethodSig.CreateInstance(retType), type);
			Create_SystemType_get_TypeHandle_result = mr;
			var md = mr.ResolveMethod();
			if (md == null || md.DeclaringType == null)
				return mr;
			var prop = md.DeclaringType.FindProperty(propName);
			if (prop == null)
				return mr;

			Create_SystemType_get_TypeHandle_result = prop;
			return prop;
		}