当前位置: 首页>>代码示例>>C#>>正文


C# Type.GetMethod方法代码示例

本文整理汇总了C#中Type.GetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# Type.GetMethod方法的具体用法?C# Type.GetMethod怎么用?C# Type.GetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type.GetMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClientReflectionHelper

		static ClientReflectionHelper ()
		{
			SystemAssembly = typeof (Uri).Assembly;
			web_header_collection = SystemAssembly.GetType ("System.Net.WebHeaderCollection");
			headers_all_keys = web_header_collection.GetProperty ("AllKeys").GetGetMethod ();

			headers_get = web_header_collection.GetMethod ("Get", new Type [] { typeof (string) });
			headers_set = web_header_collection.GetMethod ("Set", new Type [] { typeof (string), typeof (string) });

			Type network_credential = SystemAssembly.GetType ("System.Net.NetworkCredential");
			network_credential_ctor = network_credential.GetConstructor (new Type [] { typeof (string), typeof (string), typeof (string) });
		}
开发者ID:kangaroo,项目名称:moon,代码行数:12,代码来源:ClientReflectionHelper.cs

示例2: Reports_RMLauncher

	static Reports_RMLauncher()
	{
		_sendEmailMaint = System.Web.Compilation.BuildManager.GetType(_SENDEMAILMAINT_TYPE, false);
		_sendEmailMethod = null;
		MemberInfo[] search = null;
		if (_sendEmailMaint != null)
		{
			_sendEmailMethod = _sendEmailMaint.GetMethod(_SENDEMAIL_METHOD, BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public);
			search = _sendEmailMaint.GetMember(_SENDEMAILPARAMS_TYPE);
		}
		Type sendEmailParams = search != null && search.Length > 0 && search[0] is Type ? (Type)search[0] : null;
		if (sendEmailParams != null)
		{
			_sendEmailParamsCtor = sendEmailParams.GetConstructor(new Type[0]);
			_fromMethod = sendEmailParams.GetProperty("From");
			_toMethod = sendEmailParams.GetProperty("To");
			_ccMethod = sendEmailParams.GetProperty("Cc");
			_bccMethod = sendEmailParams.GetProperty("Bcc");
			_subjectMethod = sendEmailParams.GetProperty("Subject");
			_bodyMethod = sendEmailParams.GetProperty("Body");
			_activitySourceMethod = sendEmailParams.GetProperty("Source");
			_parentSourceMethod = sendEmailParams.GetProperty("ParentSource");
			_templateIDMethod = sendEmailParams.GetProperty("TemplateID");
			_attachmentsMethod = sendEmailParams.GetProperty("Attachments");
		}

		_canSendEmail = _sendEmailParamsCtor != null && _sendEmailMaint != null && _sendEmailMethod != null &&
			_fromMethod != null && _toMethod != null && _ccMethod != null && _bccMethod != null && 
			_subjectMethod != null && _bodyMethod != null &&
			_activitySourceMethod != null && _parentSourceMethod != null && _templateIDMethod != null && _attachmentsMethod != null;
	}
开发者ID:PavelMPD,项目名称:SimpleProjects,代码行数:31,代码来源:RMLauncher.aspx.cs

示例3: GetValue

		public object GetValue (string key, Type type)
		{
			if (key == null)
				throw new ArgumentNullException ("key");

			if (type == null)
				throw new ArgumentNullException ("type");

			string value = appSettings [key];
			if (value == null)
				throw new InvalidOperationException ("'" + key + "' could not be found.");

			if (type == typeof (string))
				return value;
			
			MethodInfo parse = type.GetMethod ("Parse", new Type [] {typeof (string)});
			if (parse == null)
				throw new InvalidOperationException ("Type " + type + " does not have a Parse method");

			object result = null;
			try {
				result = parse.Invoke (null, new object [] {value});
			} catch (Exception e) {
				throw new InvalidOperationException ("Parse error.", e);
			}

			return result;
		}
开发者ID:Xipas,项目名称:Symplified.Auth,代码行数:28,代码来源:AppSettingsReader.cs

示例4: Pages_ReportLauncher

	static Pages_ReportLauncher()
	{
		_sendEmailMaint = System.Web.Compilation.BuildManager.GetType(_SENDEMAILMAINT_TYPE, false);
		_sendEmailMethod = null;
		MemberInfo[] search = null;
		if (_sendEmailMaint != null)
		{
			_sendEmailMethod = _sendEmailMaint.GetMethod(_SENDEMAIL_METHOD, BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public);
			search = _sendEmailMaint.GetMember(_SENDEMAILPARAMS_TYPE);
		}
		Type sendEmailParams = search != null && search.Length > 0 && search[0] is Type ? (Type)search[0] : null;
		if (sendEmailParams != null)
		{
			_sendEmailParamsCtor = sendEmailParams.GetConstructor(new Type[0]);
			_fromMethod = sendEmailParams.GetProperty("From");
			_toMethod = sendEmailParams.GetProperty("To");
			_ccMethod = sendEmailParams.GetProperty("Cc");
			_bccMethod = sendEmailParams.GetProperty("Bcc");
			_subjectMethod = sendEmailParams.GetProperty("Subject");
			_bodyMethod = sendEmailParams.GetProperty("Body");
			_activitySourceMethod = sendEmailParams.GetProperty("Source");
			_parentSourceMethod = sendEmailParams.GetProperty("ParentSource");
			_templateIDMethod = sendEmailParams.GetProperty("TemplateID");
			_attachmentsMethod = sendEmailParams.GetProperty("Attachments");
		}

		_canSendEmail = _sendEmailParamsCtor != null && _sendEmailMaint != null && _sendEmailMethod != null &&
			_fromMethod != null && _toMethod != null && _ccMethod != null && _bccMethod != null &&
			_subjectMethod != null && _bodyMethod != null &&
			_activitySourceMethod != null && _parentSourceMethod != null && _templateIDMethod != null && _attachmentsMethod != null && !PXSiteMap.IsPortal;

		Type reportFunctionsType = System.Web.Compilation.BuildManager.GetType(_REPORTFUNCTIONS_TYPE, false);
		if (reportFunctionsType != null)
			ExpressionContext.RegisterExternalObject("Payments", Activator.CreateInstance(reportFunctionsType));
	}
开发者ID:PavelMPD,项目名称:SimpleProjects,代码行数:35,代码来源:ReportLauncher.aspx.cs

示例5: MethodDetails

    public MethodDetails(string _str_methodString, object[] _parameters, object _instance)
    {
        // for: Gets the type from the method string
        for (int i = 0; i < _str_methodString.Length; i++)
        {
            if (_str_methodString[i] == '.')
            {
                char[] c = new char[i];
                _str_methodString.CopyTo(0, c, 0, i);
                methodType = Type.GetType(new string(c));
                char[] d = new char[_str_methodString.Length - i];
                _str_methodString.CopyTo(i + 1, d, 0, _str_methodString.Length - i - 1);
                methodName = methodType.GetMethod(new string(d));

                parameters = _parameters;
                instance = _instance;
                return;
            }
        }

        methodType = null;
        methodName = null;
        parameters = null;
        instance = null;
        Debug.LogWarning("MethodDetails.MethodDetails(): Cannot get method type. methodType = " + _str_methodString + "(Possibly missing a '.'?)");
    }
开发者ID:raynertanxw,项目名称:GDP_Cellulose,代码行数:26,代码来源:ExecuteMethod.cs

示例6: RelationsInspectorLink

	// ctor. retrieves types, properties and methods
	static RelationsInspectorLink()
	{
		windowType = GetTypeInAssembly( riWindowTypeName, riAssemblyName );
		if ( windowType == null )
		{
			return; // this happens when RI is not installed. no need for an error msg here.
		}

		api1Property = windowType.GetProperty( api1PropertyName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty );
		if ( api1Property == null )
		{
			Debug.LogError( "Failed to retrieve API1 property of type " + windowType );
			return;
		}

		api1Type = GetTypeInAssembly( riAPI1TypeName, riAssemblyName );
		if ( api1Type == null )
		{
			Debug.LogError( "Failed to retrieve API1 type" );
			return;
		}

		api1ResetTargetsMethod = api1Type.GetMethod( api1ResetTargetsMethodName, api1ResetTargetsArguments );
		if ( api1ResetTargetsMethod == null )
		{
			Debug.LogError( "Failed to retrieve API method ResetTargets(object[],Type,bool)" );
			return;
		}

		RIisAvailable = true;
	}
开发者ID:riscvul,项目名称:SCP_Game_Prototype,代码行数:32,代码来源:RelationsInspectorLink.cs

示例7: InitType

	public static void InitType() {
		if (realType == null) {
			Assembly assembly = Assembly.GetAssembly(typeof(Editor));
			realType = assembly.GetType("UnityEditor.AvatarPreview");
			
			method_ctor 					= realType.GetConstructor(new Type[] { typeof(Animator), typeof(Motion)});
			property_OnAvatarChangeFunc 	= realType.GetProperty("OnAvatarChangeFunc");
			property_IKOnFeet				= realType.GetProperty("IKOnFeet");
			property_Animator				= realType.GetProperty("Animator");
			method_DoPreviewSettings		= realType.GetMethod("DoPreviewSettings");
			method_OnDestroy				= realType.GetMethod("OnDestroy");
			method_DoAvatarPreview			= realType.GetMethod("DoAvatarPreview", new Type[] {typeof(Rect), typeof(GUIStyle)});
			method_ResetPreviewInstance 	= realType.GetMethod("ResetPreviewInstance");
//			method_CalculatePreviewGameObject = realType.GetMethod("CalculatePreviewGameObject", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
			field_timeControl				= realType.GetField("timeControl");
		}
	}
开发者ID:fakestuff,项目名称:MecanimEventSystem,代码行数:17,代码来源:EditorInternalClassWrapper.cs

示例8: OnEnable

    //Type handleUtilityType;
    //Type[] types = { };

    void OnEnable() {
        selfScript = (ItemConnectionPoint)target;

        //handleUtilityType = Type.GetType("HandleUtility, Assembly_CSharp-Editor", false, false);

        Type[] editorTypes = typeof(Editor).Assembly.GetTypes();

        type_HandleUtility = editorTypes.FirstOrDefault<Type>(x => x.Name == "HandleUtility");
        meth_IntersectRayMesh = type_HandleUtility.GetMethod("IntersectRayMesh", (BindingFlags.Static | BindingFlags.NonPublic));
    }
开发者ID:DomCristaldi,项目名称:ViveHackathonGame,代码行数:13,代码来源:ItemConnectionPoint_Editor.cs

示例9: GameBehaviourMethods

    public GameBehaviourMethods( Type type )
    {
        onGameStartMethod = type.GetMethod("OnGameStart");
        onGamePauseMethod = type.GetMethod("OnGamePause");
        onGameOverMethod = type.GetMethod("OnGameOver");
        onGameClearMethod = type.GetMethod("OnGameClear");
        onGameResetMethod = type.GetMethod("OnGameReset");
        onGameResumeMethod = type.GetMethod("OnGameResume");

        postAwakeMethod = type.GetMethod("PostAwake");
        onPostDestroyMethod = type.GetMethod("OnPostDestroy");
    }
开发者ID:AndreiMarks,项目名称:ghost-bird,代码行数:12,代码来源:GameBehaviourMethods.cs

示例10: DynamicInstructionN

        public DynamicInstructionN(Type delegateType, CallSite site)
        {
            var methodInfo = delegateType.GetMethod("Invoke");
            var parameters = methodInfo.GetParameters();

            _target = CallInstruction.Create(methodInfo, parameters);
            _site = site;
            _argumentCount = parameters.Length - 1;
            _targetDelegate = site.GetType().GetField("Target").GetValue(site);
        }
开发者ID:40a,项目名称:PowerShell,代码行数:10,代码来源:DynamicInstructionN.cs

示例11: Solution

 static Solution()
 {
     s_SolutionParser = Type.GetType("Microsoft.Build.Construction.SolutionParser, Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", false, false);
     if (s_SolutionParser != null)
     {
         s_SolutionParser_solutionReader = s_SolutionParser.GetProperty("SolutionReader", BindingFlags.NonPublic | BindingFlags.Instance);
         s_SolutionParser_projects = s_SolutionParser.GetProperty("Projects", BindingFlags.NonPublic | BindingFlags.Instance);
         s_SolutionParser_parseSolution = s_SolutionParser.GetMethod("ParseSolution", BindingFlags.NonPublic | BindingFlags.Instance);
     }
 }
开发者ID:ColdenCullen,项目名称:GLIF,代码行数:10,代码来源:Solution.cs

示例12: Create

    static XunitTestCase Create(Type typeUnderTest, string methodName, params object[] arguments)
    {
        var methodUnderTest = typeUnderTest.GetMethod(methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
        var assembly = Reflector.Wrap(typeUnderTest.Assembly);
        var type = Reflector.Wrap(typeUnderTest);
        var method = Reflector.Wrap(methodUnderTest);
        var fact = Reflector.Wrap(CustomAttributeData.GetCustomAttributes(methodUnderTest)
                                                     .Single(cad => cad.AttributeType == typeof(FactAttribute)));

        return new XunitTestCase(assembly, type, method, fact, arguments.Length == 0 ? null : arguments);
    }
开发者ID:johnkg,项目名称:xunit,代码行数:11,代码来源:XunitTestCaseTests.cs

示例13: RunTests

	static void RunTests(int series, Type type)
	{
		const string Prefix = "Test";
		MethodInfo createObjectMethod = type.GetMethod ("CreateObject");
		
		foreach (MethodInfo mi in type.GetMethods ()) {
			string name = mi.Name;
			if (!name.StartsWith (Prefix))
				continue;

			int id = Convert.ToInt32 (name.Substring (Prefix.Length));

			int res = test_method_thunk (series + id, mi.MethodHandle.Value, createObjectMethod.MethodHandle.Value);

			if (res != 0) {
				Console.WriteLine ("{0} returned {1}", mi, res);
				Environment.Exit ((id << 3) + res);
			}
		}
	}
开发者ID:Zman0169,项目名称:mono,代码行数:20,代码来源:thunks.cs

示例14: CreateMetabaseSettings

        static MetabaseSettingsIis CreateMetabaseSettings(Type type)
        {
            object instance = null;
            MethodInfo method = type.GetMethod(CreateMetabaseSettingsIis7MethodName, BindingFlags.NonPublic | BindingFlags.Static);

            try
            {
                new PermissionSet(PermissionState.Unrestricted).Assert();

                instance = method.Invoke(null, null);
            }
            finally
            {
                PermissionSet.RevertAssert();
            }

            if (!(instance is MetabaseSettingsIis))
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.Hosting_BadMetabaseSettingsIis7Type(type.AssemblyQualifiedName)));
            }

            return (MetabaseSettingsIis)instance;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:HostedTransportConfigurationManager.cs

示例15: GetFilters_ReturnsEmptyCollections_ForActionsWithQueryableAttributeApplied

        public void GetFilters_ReturnsEmptyCollections_ForActionsWithQueryableAttributeApplied(
            string actionName, 
            Type controllerType)
        {
            // Arrange
            HttpConfiguration config = new HttpConfiguration();
            string controllerName = controllerType.Name.Replace("Controller","");
            HttpControllerDescriptor controllerDescriptor = new HttpControllerDescriptor(
                config, 
                controllerName,
                controllerType);

            HttpActionDescriptor actionDescriptor = new ReflectedHttpActionDescriptor(
                controllerDescriptor, 
                controllerType.GetMethod(actionName));

            // Act
            FilterInfo[] filters = new QueryFilterProvider(new EnableQueryAttribute(), skipQueryableAttribute: true)
                .GetFilters(config, actionDescriptor).ToArray();

            // Assert
            Assert.Empty(filters);
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:23,代码来源:QueryableFilterProviderTest.cs


注:本文中的Type.GetMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。