• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMethod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMethod的典型用法代码示例。如果您正苦于以下问题:C# IMethod类的具体用法?C# IMethod怎么用?C# IMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMethod类属于命名空间,在下文中一共展示了IMethod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MemberNode

		public MemberNode(IMethod method)
		{
			InitMemberNode(method);
			sortOrder = 10;
			Text = AppendReturnType(GetAmbience().Convert(method), method.ReturnType);
			SelectedImageIndex = ImageIndex = ClassBrowserIconService.GetIcon(method).ImageIndex;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:MemberNode.cs


示例2: OverrideEqualsGetHashCodeMethodsDialog

		public OverrideEqualsGetHashCodeMethodsDialog(InsertionContext context, ITextEditor editor, ITextAnchor endAnchor,
		                                              ITextAnchor insertionPosition, ITypeDefinition selectedClass, IMethod selectedMethod, AstNode baseCallNode)
			: base(context, editor, insertionPosition)
		{
			if (selectedClass == null)
				throw new ArgumentNullException("selectedClass");
			
			InitializeComponent();
			
			this.selectedClass = selectedClass;
			this.insertionEndAnchor = endAnchor;
			this.selectedMethod = selectedMethod;
			this.baseCallNode = baseCallNode;
			
			addIEquatable.Content = string.Format(StringParser.Parse("${res:AddIns.SharpRefactoring.OverrideEqualsGetHashCodeMethods.AddInterface}"),
			                                      "IEquatable<" + selectedClass.Name + ">");
			
			string otherMethod = selectedMethod.Name == "Equals" ? "GetHashCode" : "Equals";
			
			addOtherMethod.Content = StringParser.Parse("${res:AddIns.SharpRefactoring.OverrideEqualsGetHashCodeMethods.AddOtherMethod}", new StringTagPair("otherMethod", otherMethod));
			
			addIEquatable.IsEnabled = !selectedClass.GetAllBaseTypes().Any(
				type => {
					if (!type.IsParameterized || (type.TypeParameterCount != 1))
						return false;
					if (type.FullName != "System.IEquatable")
						return false;
					return type.TypeArguments.First().FullName == selectedClass.FullName;
				}
			);
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:31,代码来源:OverrideEqualsGetHashCodeMethodsDialog.xaml.cs


示例3: OnMethod

		public override void OnMethod(Method node)
		{
			var old = _currentMethod;
			_currentMethod = (IMethod) node.Entity;
			base.OnMethod(node);
			_currentMethod = old;
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:7,代码来源:DetectInnerGenerics.cs


示例4: CompareTo

        public virtual int CompareTo(IMethod value)
        {
            int cmp;

            cmp = base.CompareTo((IDecoration)value);

            if (cmp != 0) {
                return cmp;
            }

            if (FullyQualifiedName != null) {
                cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
                if (cmp != 0) {
                    return cmp;
                }
            }

            if (ReturnType != null) {
                cmp = ReturnType.CompareTo(value.ReturnType);
                if (cmp != 0) {
                    return cmp;
                }
            }

            if (Region != null) {
                cmp = Region.CompareTo(value.Region);
                if (cmp != 0) {
                    return cmp;
                }
            }

            return DiffUtility.Compare(Parameters, value.Parameters);
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:33,代码来源:AbstractMethod.cs


示例5: DefaultTypeParameter

 public DefaultTypeParameter(IMethod method, Type type)
 {
     this.method = method;
     this.targetClass = method.DeclaringType;
     this.name = type.Name;
     this.index = type.GenericParameterPosition;
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:7,代码来源:DefaultTypeParameter.cs


示例6: CreateRequiredConstructor

        internal CodeConstructor CreateRequiredConstructor(CodeTypeDeclaration resourceClass,
                                                           IMethod request,
                                                           bool addOptionalParameters)
        {
            var constructor = new CodeConstructor();
            constructor.Attributes = MemberAttributes.Public;

            // IRequestProvider service
            var serviceArg = new CodeParameterDeclarationExpression(typeof(IRequestProvider), ServiceName);
            constructor.Parameters.Add(serviceArg);

            // : base(service, "path", "HTTPMETHOD")
            constructor.BaseConstructorArgs.Add(
                new CodePropertyReferenceExpression(
                    new CodeVariableReferenceExpression(ServiceName), BaseUriName));
            constructor.BaseConstructorArgs.Add(new CodePrimitiveExpression(request.MediaUpload.Simple.Path));
            constructor.BaseConstructorArgs.Add(new CodePrimitiveExpression(request.HttpMethod));

            // Add all required arguments to the constructor.
            AddBodyParameter(constructor, request);

            // Add common upload arguements.
            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(StreamParameterName));
            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(ContentTypeParameterName));

            AddAuthorizationAssignment(constructor);
            AddRequestParameters(resourceClass, request, constructor, addOptionalParameters);

            constructor.Parameters.Add(new CodeParameterDeclarationExpression(
                new CodeTypeReference(typeof(System.IO.Stream)), StreamParameterName));
            constructor.Parameters.Add(new CodeParameterDeclarationExpression(
                new CodeTypeReference(typeof(System.String)), ContentTypeParameterName));

            return constructor;
        }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:35,代码来源:UploadConstructorDecorator.cs


示例7: GetMethodSemantics

		private MethodScriptSemantics GetMethodSemantics(IMethod m) {
			if (m.IsAccessor) {
				var prop = m.AccessorOwner as IProperty;
				if (prop != null) {
					var psem = _metadataImporter.GetPropertySemantics(prop);
					if (psem.Type != PropertyScriptSemantics.ImplType.GetAndSetMethods)
						throw new InvalidOperationException("Property " + prop.Name + " should be implemented with get/set methods");
					if (m.Equals(prop.Getter))
						return psem.GetMethod;
					else if (m.Equals(prop.Setter))
						return psem.SetMethod;
					else
						throw new Exception(m + " is neither the getter nor the setter for " + prop);
				}

				var evt = m.AccessorOwner as IEvent;
				if (evt != null) {
					var esem = _metadataImporter.GetEventSemantics(evt);
					if (esem.Type != EventScriptSemantics.ImplType.AddAndRemoveMethods)
						throw new InvalidOperationException("Event " + prop.Name + " should be implemented with add/remove methods");
					if (m.Equals(evt.AddAccessor))
						return esem.AddMethod;
					else if (m.Equals(evt.RemoveAccessor))
						return esem.RemoveMethod;
					else
						throw new Exception(m + " is neither the adder nor the remover for " + evt);
				}

				throw new ArgumentException("Invalid accessor owner " + m.AccessorOwner + " on member " + m);
			}
			else
				return _metadataImporter.GetMethodSemantics(m);
		}
开发者ID:kumar0190,项目名称:SaltarelleCompiler,代码行数:33,代码来源:RuntimeLibrary.cs


示例8: Exists

		public bool Exists(IMethod method) {
			if (method == null)
				return false;
			if (method.DeclaringType != null && types.Find(method.DeclaringType))
				return true;
			return methods.Find(method);
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:7,代码来源:MethodCollection.cs


示例9: DecorateClass

 public override void DecorateClass(IResource resource,
                           IMethod request,
                           CodeTypeDeclaration requestClass,
                           CodeTypeDeclaration resourceClass)
 {
     requestClass.Members.Add(CreateRequiredConstructor(resourceClass, request, false));
 }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:7,代码来源:UploadConstructorDecorator.cs


示例10: ExternalGenericParameter

		public ExternalGenericParameter(IReflectionTypeSystemProvider provider, Type type) : base(provider, type)
		{
			if (type.DeclaringMethod != null)
			{
				_declaringMethod = (IMethod)provider.Map(type.DeclaringMethod);
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:7,代码来源:ExternalGenericParameter.cs


示例11: IsValidTestMethod

        public bool IsValidTestMethod(IProject project, IClass testClass, IMethod testMethod)
        {
            if (project == null || testClass == null || testMethod == null)
                return false;

            return IsValidTestMethod(project, testClass.GetClrName().FullName, testMethod.ShortName);
        }
开发者ID:jbogard,项目名称:ReSharperFixieRunner,代码行数:7,代码来源:TestIdentifier.cs


示例12: DefaultMethod

		/// <summary>
		/// Copy constructor
		/// </summary>
		protected DefaultMethod(IMethod method) : base(method)
		{
			returnTypeAttributes = CopyList(method.ReturnTypeAttributes);
			typeParameters = CopyList(method.TypeParameters);
			parameters = CopyList(method.Parameters);
			this.IsExtensionMethod = method.IsExtensionMethod;
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:10,代码来源:DefaultMethod.cs


示例13: AddSenderAndEventArgsParameters

		void AddSenderAndEventArgsParameters(IMethod method)
		{
			DefaultReturnType returnType = new DefaultReturnType(method.DeclaringType);
			DomRegion region = new DomRegion();
			method.Parameters.Add(new DefaultParameter("sender", returnType, region));
			method.Parameters.Add(new DefaultParameter("e", returnType, region));
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:AddHandlerConversionTestFixture.cs


示例14: MethodDrop

 public MethodDrop(ITable table, IMethod method)
     : base(method)
 {
     this.table = table;
     this.method = method;
     tableMemberDrop = new TableMemberDrop(table, method);
 }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:7,代码来源:MethodDrop.cs


示例15: GetSymbols

		public static ILSpyUnresolvedFile GetSymbols(IMethod method)
		{
			var typeName = DecompiledTypeReference.FromTypeDefinition(method.DeclaringTypeDefinition);
			if (typeName == null) return null;
			SD.Log.DebugFormatted("GetSymbols for: {0}", typeName.ToFileName());
			return SD.ParserService.ParseFile(typeName.ToFileName()) as ILSpyUnresolvedFile;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:7,代码来源:ILSpySymbolSource.cs


示例16: GenerateParameterProperty

        internal CodeTypeMemberCollection GenerateParameterProperty(IParameter parameter,
            IMethod method,
            CodeTypeDeclaration resourceClass,
            IEnumerable<string> usedNames)
        {
            // Get the name and return type of this parameter.
            string name = parameter.Name;
            CodeTypeReference returnType = ResourceBaseGenerator.GetParameterTypeReference(
                resourceClass, parameter);

            // Generate the property and field.
            CodeTypeMemberCollection newMembers = DecoratorUtil.CreateAutoProperty(
                name, parameter.Description, returnType, usedNames, parameter.IsRequired);

            // Add the KeyAttribute to the property.
            foreach (CodeTypeMember member in newMembers)
            {
                CodeMemberProperty property = member as CodeMemberProperty;
                if (property == null)
                {
                    continue;
                }

                // Declare the RequestParameter attribute.
                CodeTypeReference attributeType = new CodeTypeReference(typeof(RequestParameterAttribute));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(attributeType);
                attribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(parameter.Name)));
                property.CustomAttributes.Add(attribute);
            }

            return newMembers;
        }
开发者ID:nick0816,项目名称:LoggenCSG,代码行数:32,代码来源:ParameterPropertyDecorator.cs


示例17: Reset

 public void Reset(IMethod method, ITypeInfo typeInfo)
 {
     this.method = method;
     var containingType = method.GetContainingType();
     TypeName = containingType.GetClrName().FullName;
     Class = typeInfo ?? ((IClass) containingType).AsTypeInfo();
 }
开发者ID:EddieGarmon,项目名称:resharper-xunit,代码行数:7,代码来源:PsiMethodInfoAdapter.cs


示例18: createCallResult

 protected override CallResult createCallResult(IMethod method, MethodSpec gim, Block block, int callInstrIndex)
 {
     int methodId;
     if (!methodTokenToId.TryGetValue(method.MDToken.ToInt32(), out methodId))
         return null;
     return new MyCallResult(block, callInstrIndex, methodId, gim);
 }
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:StringInliner.cs


示例19: Convert

		public IMethodDefOrRef Convert(IMethod methodRef) {
			if (!(methodRef is MemberRef || methodRef is MethodDef) || methodRef.MethodSig == null)
				throw new ApplicationException("Invalid method reference type");
			if (IsInOurModule(methodRef))
				return (IMethodDefOrRef)TryGetMethodDef(methodRef);
			return (IMethodDefOrRef)CreateImporter().Import(methodRef);
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:7,代码来源:MemberReferenceConverter.cs


示例20: WriteCallInvokeMethod

        /// <summary>
        /// </summary>
        /// <param name="llvmWriter">
        /// </param>
        /// <param name="objectResult">
        /// </param>
        /// <param name="methodResult">
        /// </param>
        /// <param name="invokeMethod">
        /// </param>
        /// <param name="isStatic">
        /// </param>
        /// <returns>
        /// </returns>
        public static FullyDefinedReference WriteCallInvokeMethod(
            this LlvmWriter llvmWriter, FullyDefinedReference objectResult, FullyDefinedReference methodResult, IMethod invokeMethod, bool isStatic)
        {
            var writer = llvmWriter.Output;

            var method = new SynthesizedInvokeMethod(llvmWriter, objectResult, methodResult, invokeMethod, isStatic);
            var opCodeNope = OpCodePart.CreateNop;

            opCodeNope.OpCodeOperands =
                Enumerable.Range(0, invokeMethod.GetParameters().Count()).Select(p => new OpCodeInt32Part(OpCodesEmit.Ldarg, 0, 0, p + 1)).ToArray();

            foreach (var generatedOperand in opCodeNope.OpCodeOperands)
            {
                llvmWriter.ActualWrite(writer, generatedOperand);
            }

            writer.WriteLine(string.Empty);

            // bitcast object to method
            var opCodeNopeForBitCast = OpCodePart.CreateNop;
            opCodeNopeForBitCast.OpCodeOperands = new[] { OpCodePart.CreateNop };
            opCodeNopeForBitCast.OpCodeOperands[0].Result = methodResult;
            llvmWriter.UnaryOper(writer, opCodeNopeForBitCast, "bitcast", methodResult.Type, options: LlvmWriter.OperandOptions.GenerateResult);
            writer.Write(" to ");
            llvmWriter.WriteMethodPointerType(writer, method);
            writer.WriteLine(string.Empty);

            method.MethodResult = opCodeNopeForBitCast.Result;

            // actual call
            llvmWriter.WriteCall(opCodeNope, method, false, !isStatic, false, objectResult, llvmWriter.tryScopes.Count > 0 ? llvmWriter.tryScopes.Peek() : null);
            writer.WriteLine(string.Empty);

            return opCodeNope.Result;
        }
开发者ID:SperoSophia,项目名称:il2bc,代码行数:49,代码来源:DelegateGen.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMethodBody类代码示例发布时间:2022-05-24
下一篇:
C# IMetadataVisitor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap