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


C# IMethod类代码示例

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


IMethod类属于命名空间,在下文中一共展示了IMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: StringFormatWriter

        public StringFormatWriter(ModuleDeclaration module)
        {
            this.module = module;
            ITypeSignature stringType = module.Cache.GetType(typeof(string));

            this.format1Method = module.FindMethod(stringType, "Format",
                method => method.Parameters.Count == 2 &&
                          IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
                          IntrinsicTypeSignature.Is(method.Parameters[1].ParameterType, IntrinsicType.Object));

            this.format2Method = module.FindMethod(stringType, "Format",
                method => method.Parameters.Count == 3 &&
                          IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
                          IntrinsicTypeSignature.Is(method.Parameters[1].ParameterType, IntrinsicType.Object) &&
                          IntrinsicTypeSignature.Is(method.Parameters[2].ParameterType, IntrinsicType.Object));

            this.format3Method = module.FindMethod(stringType, "Format",
                method => method.Parameters.Count == 4 &&
                          IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
                          IntrinsicTypeSignature.Is(method.Parameters[1].ParameterType, IntrinsicType.Object) &&
                          IntrinsicTypeSignature.Is(method.Parameters[2].ParameterType, IntrinsicType.Object) &&
                          IntrinsicTypeSignature.Is(method.Parameters[3].ParameterType, IntrinsicType.Object));

            this.formatArrayMethod = module.FindMethod(stringType, "Format",
                method => method.Parameters.Count == 2 &&
                          IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
                          method.Parameters[1].ParameterType.BelongsToClassification(TypeClassifications.Array));
        }
开发者ID:halad,项目名称:PostSharp-Toolkits,代码行数:28,代码来源:StringFormatWriter.cs


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