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


C# IType.GetMethods方法代码示例

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


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

示例1: FindMethod

 public IMethodInfo FindMethod(IType type, Type attribute)
 {
     var q = from m in type.GetMethods()
             where m.GetCustomAttributes(attribute, true).Any()
             select m;
     return q.FirstOrDefault();
 }
开发者ID:sigomatix,项目名称:MyCode,代码行数:7,代码来源:AssemblySearcher.cs

示例2: CollectMembersToImplement

        public static List<IMember> CollectMembersToImplement(ITypeDefinition implementingType, IType abstractType)
        {
            //			var def = abstractType.GetDefinition();
            var toImplement = new List<IMember>();
            bool alreadyImplemented;

            // Stub out non-implemented events defined by @iface
            foreach (var ev in abstractType.GetEvents (e => !e.IsSynthetic && e.IsAbstract)) {
                alreadyImplemented = implementingType.GetAllBaseTypeDefinitions().Any(
                    x => x.Kind != TypeKind.Interface && x.Events.Any (y => y.Name == ev.Name)
                    );

                if (!alreadyImplemented)
                    toImplement.Add(ev);
            }

            // Stub out non-implemented methods defined by @iface
            foreach (var method in abstractType.GetMethods (d => !d.IsSynthetic  && d.IsAbstract)) {
                alreadyImplemented = false;

                var allBaseTypes = method.DeclaringType.GetAllBaseTypes().ToList ();
                foreach (var cmet in implementingType.GetMethods (d => !d.IsAbstract && d.Name == method.Name)) {
                    if (allBaseTypes.Contains(cmet.DeclaringType))
                        continue;
                    if (ImplementInterfaceAction.CompareMethods(method, cmet)) {
                        alreadyImplemented = true;
                        break;
                    }
                }
                if (!alreadyImplemented)
                    toImplement.Add(method);
            }

            // Stub out non-implemented properties defined by @iface
            foreach (var prop in abstractType.GetProperties (p => !p.IsSynthetic && p.IsAbstract)) {
                alreadyImplemented = false;
                foreach (var t in implementingType.GetAllBaseTypeDefinitions ()) {
                    if (t.Kind == TypeKind.Interface)
                        continue;
                    foreach (IProperty cprop in t.Properties) {
                        if (!cprop.IsAbstract && cprop.Name == prop.Name) {
                            alreadyImplemented = true;
                        }
                    }
                }
                if (!alreadyImplemented)
                    toImplement.Add(prop);
            }
            return toImplement;
        }
开发者ID:segaman,项目名称:NRefactory,代码行数:50,代码来源:ImplementAbstractMembersAction.cs

示例3: GetMethods

 protected IEnumerable<IMethod> GetMethods(IType type)
 {
     IList<IMethod> methods = new List<IMethod> ();
     foreach (IMethod method in type.GetMethods()) {
         if (!AttributeHelper.HasAttribute (method, Constants.IBACTION)) {
             continue;
         }
         if (!AttributeHelper.HasAttribute (method, Constants.OBJECTIVE_C_MESSAGE)) {
             continue;
         }
         if (method.Parameters.Count != 1) {
             continue;
         }
         methods.Add (method);
     }
     return methods;
 }
开发者ID:Monobjc,项目名称:monobjc-monodevelop,代码行数:17,代码来源:ObjectiveCWriter.cs

示例4: GetElementType

        public static IType GetElementType(CSharpAstResolver resolver, IType type)
        {
            // TODO: A better get element type method.
            if (type.Kind == TypeKind.Array || type.Kind == TypeKind.Dynamic) {
                if (type.Kind == TypeKind.Array)
                    return ((ArrayType)type).ElementType;
                return resolver.Compilation.FindType(KnownTypeCode.Object);
            }

            foreach (var method in type.GetMethods (m => m.Name == "GetEnumerator")) {
                IType returnType = null;
                foreach (var prop in method.ReturnType.GetProperties(p => p.Name == "Current")) {
                    if (returnType != null && prop.ReturnType.IsKnownType (KnownTypeCode.Object))
                        continue;
                    returnType = prop.ReturnType;
                }
                if (returnType != null)
                    return returnType;
            }

            return resolver.Compilation.FindType(KnownTypeCode.Object);
        }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:22,代码来源:TypeGuessing.cs

示例5: DoPositionalArgsCompletion

		/// <remarks>returns true if elements from named args completion should be added afterwards.</remarks>
		bool DoPositionalArgsCompletion(XamlCompletionItemList list, XamlCompletionContext context, MarkupExtensionInfo markup, IType type)
		{
			switch (type.FullName) {
				case "System.Windows.Markup.ArrayExtension":
				case "System.Windows.Markup.NullExtension":
					// x:Null/x:Array does not need completion, ignore it
					break;
				case "System.Windows.Markup.StaticExtension":
					if (context.AttributeValue.ExtensionValue.PositionalArguments.Count <= 1)
						return DoStaticExtensionCompletion(list, context);
					break;
				case "System.Windows.Markup.TypeExtension":
					if (context.AttributeValue.ExtensionValue.PositionalArguments.Count <= 1) {
						list.Items.AddRange(GetClassesFromContext(context).FlattenToList());
						AttributeValue selItem = Utils.GetMarkupExtensionAtPosition(context.AttributeValue.ExtensionValue, context.ValueStartOffset)
							.PositionalArguments.LastOrDefault();
						string word = context.Editor.GetWordBeforeCaret().TrimEnd();
						if (selItem != null && selItem.IsString && word == selItem.StringValue) {
							list.PreselectionLength = selItem.StringValue.Length;
						}
					}
					break;
				default:
					var ctors = type.GetMethods(m => m.IsPublic && m.IsConstructor && m.Parameters.Count >= markup.PositionalArguments.Count + 1);
					if (context.Forced)
						return true;
					if (ctors.Any() || markup.PositionalArguments.Count == 0)
						return false;
					break;
			}
			
			return true;
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:34,代码来源:CompletionDataGenerator.cs

示例6: FindSignalHandler

		IMethod FindSignalHandler (IType cls, Stetic.Signal signal)
		{
			foreach (var met in cls.GetMethods ()) {
				if (met.Name == signal.Handler) {
					return met;
				}
			}
			return null;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:9,代码来源:CodeBinder.cs

示例7: AddVirtuals

		void AddVirtuals (Dictionary<string, bool> alreadyInserted, CompletionDataWrapper col, string modifiers, IType curType, int declarationBegin)
		{
			if (curType == null)
				return;
			foreach (var m in curType.GetMethods (m => !m.IsConstructor && !m.IsDestructor).Cast<IMember> ().Concat (curType.GetProperties ().Cast<IMember> ()).Reverse ()) {
				if (m.IsSynthetic || curType.Kind != TypeKind.Interface && !m.IsOverridable)
					continue;
				// filter out the "Finalize" methods, because finalizers should be done with destructors.
				if (m is IMethod && m.Name == "Finalize")
					continue;
				
				var data = factory.CreateNewOverrideCompletionData (declarationBegin, currentType, m);
				string text = GetNameWithParamCount (m);
				
				// check if the member is already implemented
				bool foundMember = curType.GetMembers ().Any (cm => GetNameWithParamCount (cm) == text && cm.DeclaringTypeDefinition == curType.GetDefinition ());
				if (foundMember)
					continue;
				if (alreadyInserted.ContainsKey (text))
					continue;
				alreadyInserted [text] = true;
				data.CompletionCategory = col.GetCompletionCategory (curType);
				col.Add (data);
			}
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:25,代码来源:CppCompletionEngine.cs

示例8: AddImplementation

        static void AddImplementation(RefactoringContext context, TypeDeclaration result, IType guessedType)
        {
            foreach (var property in guessedType.GetProperties ()) {
                if (!property.IsAbstract)
                    continue;
                if (property.IsIndexer) {
                    var indexerDecl = new IndexerDeclaration {
                        ReturnType = context.CreateShortType(property.ReturnType),
                        Modifiers = GetModifiers(property),
                        Name = property.Name
                    };
                    indexerDecl.Parameters.AddRange(ConvertParameters(context, property.Parameters));
                    if (property.CanGet)
                        indexerDecl.Getter = new Accessor();
                    if (property.CanSet)
                        indexerDecl.Setter = new Accessor();
                    result.AddChild(indexerDecl, Roles.TypeMemberRole);
                    continue;
                }
                var propDecl = new PropertyDeclaration {
                    ReturnType = context.CreateShortType(property.ReturnType),
                    Modifiers = GetModifiers (property),
                    Name = property.Name
                };
                if (property.CanGet)
                    propDecl.Getter = new Accessor();
                if (property.CanSet)
                    propDecl.Setter = new Accessor();
                result.AddChild(propDecl, Roles.TypeMemberRole);
            }

            foreach (var method in guessedType.GetMethods ()) {
                if (!method.IsAbstract)
                    continue;
                var decl = new MethodDeclaration {
                    ReturnType = context.CreateShortType(method.ReturnType),
                    Modifiers = GetModifiers (method),
                    Name = method.Name,
                    Body = new BlockStatement {
                        new ThrowStatement(new ObjectCreateExpression(context.CreateShortType("System", "NotImplementedException")))
                    }
                };
                decl.Parameters.AddRange(ConvertParameters(context, method.Parameters));
                result.AddChild(decl, Roles.TypeMemberRole);
            }

            foreach (var evt in guessedType.GetEvents ()) {
                if (!evt.IsAbstract)
                    continue;
                var decl = new EventDeclaration {
                    ReturnType = context.CreateShortType(evt.ReturnType),
                    Modifiers = GetModifiers (evt),
                    Variables = {
                        new VariableInitializer {
                            Name = evt.Name
                        }
                    }
                };
                decl.Variables.Add(new VariableInitializer(evt.Name));
                result.AddChild(decl, Roles.TypeMemberRole);
            }
        }
开发者ID:CSRedRat,项目名称:NRefactory,代码行数:62,代码来源:CreateClassDeclarationAction.cs

示例9: CollectMembers

		internal static IEnumerable<IEntity> CollectMembers (IType type)
		{
			yield return (IEntity)type;
			foreach (var c in type.GetDefinition ().GetMembers (m => m.SymbolKind == SymbolKind.Constructor, GetMemberOptions.IgnoreInheritedMembers)) {
				if (!c.IsSynthetic)
					yield return c;
			}

			foreach (var m in type.GetMethods (m  => m.IsDestructor, GetMemberOptions.IgnoreInheritedMembers)) {
				yield return m;
			}
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:12,代码来源:ReferencesFinder.cs

示例10: GetCompatibleMethodsInClass

		//TODO: check accessibility
		public static IEnumerable<IMethod> GetCompatibleMethodsInClass (IType cls, IMethod matchMeth)
		{
			IType[] pars = new IType[matchMeth.Parameters.Count];
			List<IType>[] baseTypes = new List<IType>[matchMeth.Parameters.Count];
			for (int i = 0; i < matchMeth.Parameters.Count; i++) {
				pars[i] = matchMeth.Parameters[i].Type;
				baseTypes[i] = new List<IType> (pars[i].GetAllBaseTypes ());
			}
			
			var matchMethType = matchMeth.ReturnType;
			
			foreach (IMethod method in cls.GetMethods ()) {
				if (method.IsPrivate || method.Parameters.Count != pars.Length || !method.ReturnType.Equals (matchMethType) 
				    || method.IsInternal)
					continue;
				
				bool allCompatible = true;
				
				//compare each parameter
				for (int i = 0; i < pars.Length; i++) {
					var pt = method.Parameters[i].Type;
					bool parCompatible = pars[i].Equals (pt);
					if (!parCompatible && !baseTypes[i].Any (t => t.Equals (pt))) {
						allCompatible = false;
						break;
					}
				}
				
				if (allCompatible)
					yield return method;
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:33,代码来源:BindingService.cs

示例11: FindAttachedMember

		IMember FindAttachedMember(IType type, string propertyName, out IMember underlyingMember)
		{
			underlyingMember = type
				.GetMethods(m => m.IsPublic && m.IsStatic && m.Parameters.Count == 1
				            && m.Name == "Get" + propertyName)
				.FirstOrDefault();
			var definition = type.GetDefinition();
			if (definition != null) {
				ITypeResolveContext localContext = new SimpleTypeResolveContext(definition);
				if (underlyingMember != null)
					return new DefaultUnresolvedProperty { Name = propertyName }
				.CreateResolved(localContext);
				
				underlyingMember = type
					.GetMethods(m => m.IsPublic && m.IsStatic && m.Parameters.Count == 2
					            && m.Name == "Add" + propertyName + "Handler")
					.FirstOrDefault();
				if (underlyingMember != null)
					return new DefaultUnresolvedEvent { Name = propertyName }
				.CreateResolved(localContext);
			}
			return null;
		}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:23,代码来源:XamlAstResolver.cs

示例12: Lookup

		/// <summary>
		/// Performs a member lookup.
		/// </summary>
		public ResolveResult Lookup(IType type, string name, IList<IType> typeArguments, bool isInvocation)
		{
			int typeArgumentCount = typeArguments.Count;
			
			List<IType> types = new List<IType>();
			List<IMember> members = new List<IMember>();
			if (!isInvocation) {
				// Consider nested types only if it's not an invocation. The type parameter count must match in this case.
				Predicate<ITypeDefinition> typeFilter = delegate (ITypeDefinition d) {
					return d.TypeParameterCount == typeArgumentCount && d.Name == name && IsAccessible(d, true);
				};
				types.AddRange(type.GetNestedTypes(context, typeFilter));
			}
			
			bool allowProtectedAccess = IsProtectedAccessAllowed(type);
			
			if (typeArgumentCount == 0) {
				Predicate<IMember> memberFilter = delegate(IMember member) {
					return !member.IsOverride && member.Name == name && IsAccessible(member, allowProtectedAccess);
				};
				members.AddRange(type.GetMethods(context, memberFilter.SafeCast<IMember, IMethod>()).SafeCast<IMethod, IMember>());
				members.AddRange(type.GetProperties(context, memberFilter.SafeCast<IMember, IProperty>()).SafeCast<IProperty, IMember>());
				members.AddRange(type.GetFields(context, memberFilter.SafeCast<IMember, IField>()).SafeCast<IField, IMember>());
				members.AddRange(type.GetEvents(context, memberFilter.SafeCast<IMember, IEvent>()).SafeCast<IEvent, IMember>());
				if (isInvocation)
					members.RemoveAll(m => !IsInvocable(m, context));
			} else {
				// No need to check for isInvocation/isInvocable here:
				// we filter out all non-methods
				Predicate<IMethod> memberFilter = delegate(IMethod method) {
					return method.TypeParameters.Count == typeArgumentCount
						&& !method.IsOverride && method.Name == name && IsAccessible(method, allowProtectedAccess);
				};
				members.AddRange(type.GetMethods(context, memberFilter).SafeCast<IMethod, IMember>());
			}
			
			// TODO: can't members also hide types?
			
			RemoveTypesHiddenByOtherTypes(types);
			// remove members hidden by types
			for (int i = 0; i < types.Count; i++) {
				ITypeDefinition d = GetDeclaringTypeDef(types[i]);
				if (d != null)
					members.RemoveAll(m => d.IsDerivedFrom(m.DeclaringTypeDefinition, context));
			}
			// remove members hidden by other members
			for (int i = members.Count - 1; i >= 0; i--) {
				ITypeDefinition d = members[i].DeclaringTypeDefinition;
				IMethod mi = members[i] as IMethod;
				// nested loop depends on the fact that the members of more derived classes appear later in the list
				for (int j = i + 1; j < members.Count; j++) {
					if (mi != null) {
						IMethod mj = members[j] as IMethod;
						if (mj != null && !ParameterListComparer.Instance.Equals(mi, mj))
							continue;
					}
					ITypeDefinition s = members[j].DeclaringTypeDefinition;
					if (s != null && s != d && s.IsDerivedFrom(d, context)) {
						// members[j] hides members[i]
						members.RemoveAt(i);
						break;
					}
				}
			}
			// remove interface members hidden by class members
			if (type is ITypeParameter) {
				// this can happen only with type parameters
				for (int i = members.Count - 1; i >= 0; i--) {
					ITypeDefinition d = members[i].DeclaringTypeDefinition;
					if (d.ClassType != ClassType.Interface)
						continue;
					IMethod mi = members[i] as IMethod;
					for (int j = 0; j < members.Count; j++) {
						if (mi != null) {
							IMethod mj = members[j] as IMethod;
							if (mj != null && !ParameterListComparer.Instance.Equals(mi, mj))
								continue;
						}
						ITypeDefinition s = members[j].DeclaringTypeDefinition;
						if (s != null && IsNonInterfaceType(s)) {
							// members[j] hides members[i]
							members.RemoveAt(i);
							break;
						}
					}
				}
			}
			
			if (types.Count > 0) {
				bool isAmbiguous = !(types.Count == 1 && members.Count == 0);
				return CreateTypeResolveResult(types[0], isAmbiguous, typeArguments);
			}
			if (members.Count == 0)
				return new UnknownMemberResolveResult(type, name, typeArguments);
			IMember firstNonMethod = members.FirstOrDefault(m => !(m is IMethod));
			if (members.Count == 1 && firstNonMethod != null)
				return new MemberResolveResult(firstNonMethod, context);
//.........这里部分代码省略.........
开发者ID:constructor-igor,项目名称:cudafy,代码行数:101,代码来源:MemberLookup.cs

示例13: CollectMembersToImplement

		public static List<Tuple<IMember, bool>> CollectMembersToImplement(ITypeDefinition implementingType, IType interfaceType, bool explicitly)
		{
			var def = interfaceType.GetDefinition();
			List<Tuple<IMember, bool>> toImplement = new List<Tuple<IMember, bool>>();
			bool alreadyImplemented;
			// Stub out non-implemented events defined by @iface
			foreach (var ev in interfaceType.GetEvents (e => !e.IsSynthetic && e.DeclaringTypeDefinition.ReflectionName == def.ReflectionName)) {
				bool needsExplicitly = explicitly;
				alreadyImplemented = implementingType.GetAllBaseTypeDefinitions().Any(
					x => x.Kind != TypeKind.Interface && x.Events.Any (y => y.Name == ev.Name)
				);

				if (!alreadyImplemented)
					toImplement.Add(new Tuple<IMember, bool>(ev, needsExplicitly));
			}

			// Stub out non-implemented methods defined by @iface
			foreach (var method in interfaceType.GetMethods (d => !d.IsSynthetic && d.DeclaringTypeDefinition.ReflectionName == def.ReflectionName)) {
				bool needsExplicitly = explicitly;
				alreadyImplemented = false;
				
				foreach (var cmet in implementingType.GetMethods ()) {
					if (CompareMethods(method, cmet)) {
						if (!needsExplicitly && !cmet.ReturnType.Equals(method.ReturnType))
							needsExplicitly = true;
						else
							alreadyImplemented |= !needsExplicitly /*|| cmet.InterfaceImplementations.Any (impl => impl.InterfaceType.Equals (interfaceType))*/;
					}
				}
				if (!alreadyImplemented) 
					toImplement.Add(new Tuple<IMember, bool>(method, needsExplicitly));
			}

			// Stub out non-implemented properties defined by @iface
			foreach (var prop in interfaceType.GetProperties (p => !p.IsSynthetic && p.DeclaringTypeDefinition.ReflectionName == def.ReflectionName)) {
				bool needsExplicitly = explicitly;
				alreadyImplemented = false;
				foreach (var t in implementingType.GetAllBaseTypeDefinitions ()) {
					if (t.Kind == TypeKind.Interface)
						continue;
					foreach (IProperty cprop in t.Properties) {
						if (cprop.Name == prop.Name) {
							if (!needsExplicitly && !cprop.ReturnType.Equals(prop.ReturnType))
								needsExplicitly = true;
							else
								alreadyImplemented |= !needsExplicitly/* || cprop.InterfaceImplementations.Any (impl => impl.InterfaceType.Resolve (ctx).Equals (interfaceType))*/;
						}
					}
				}
				if (!alreadyImplemented)
					toImplement.Add(new Tuple<IMember, bool>(prop, needsExplicitly));
			}
			return toImplement;
		}
开发者ID:nieve,项目名称:NRefactory,代码行数:54,代码来源:ImplementInterfaceAction.cs

示例14: GetMethodsImpl

		static IEnumerable<IMethod> GetMethodsImpl(IType baseType, IList<IType> methodTypeArguments, Predicate<IUnresolvedMethod> filter, GetMemberOptions options)
		{
			IEnumerable<IMethod> declaredMethods = baseType.GetMethods(filter, options | declaredMembers);
			
			ParameterizedType pt = baseType as ParameterizedType;
			if ((options & GetMemberOptions.ReturnMemberDefinitions) == 0
			    && (pt != null || (methodTypeArguments != null && methodTypeArguments.Count > 0)))
			{
				TypeParameterSubstitution substitution = null;
				foreach (IMethod m in declaredMethods) {
					if (methodTypeArguments != null && methodTypeArguments.Count > 0) {
						if (m.TypeParameters.Count != methodTypeArguments.Count)
							continue;
					}
					if (substitution == null) {
						if (pt != null)
							substitution = pt.GetSubstitution(methodTypeArguments);
						else
							substitution = new TypeParameterSubstitution(null, methodTypeArguments);
					}
					yield return new SpecializedMethod(m, substitution);
				}
			} else {
				foreach (IMethod m in declaredMethods) {
					yield return m;
				}
			}
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:28,代码来源:GetMembersHelper.cs

示例15: CollectMembersToImplement

		public static List<Tuple<IMember, bool>> CollectMembersToImplement(ITypeDefinition implementingType, IType interfaceType, bool explicitly, out bool interfaceMissing)
		{
			//var def = interfaceType.GetDefinition();
			List<Tuple<IMember, bool>> toImplement = new List<Tuple<IMember, bool>>();
			bool alreadyImplemented;
			interfaceMissing = true;
			// Stub out non-implemented events defined by @iface
			foreach (var evGroup in interfaceType.GetEvents (e => !e.IsSynthetic).GroupBy (m => m.DeclaringType).Reverse ())
				foreach (var ev in evGroup) {
					if (ev.DeclaringType.Kind != TypeKind.Interface)
						continue;

					bool needsExplicitly = explicitly;
					alreadyImplemented = implementingType.GetMembers().Any(m => m.ImplementedInterfaceMembers.Any(im => IsImplementation (im, ev)));
				
					if (!alreadyImplemented) {
						toImplement.Add(new Tuple<IMember, bool>(ev, needsExplicitly));
					} else {
						interfaceMissing = false;
					}
				}
			
			// Stub out non-implemented methods defined by @iface
			foreach (var methodGroup in interfaceType.GetMethods (d => !d.IsSynthetic).GroupBy (m => m.DeclaringType).Reverse ())
				foreach (var method in methodGroup) {
					if (method.DeclaringType.Kind != TypeKind.Interface)
						continue;
					bool needsExplicitly = explicitly;
					alreadyImplemented = false;

					foreach (var cmet in implementingType.GetMethods ()) {
						alreadyImplemented |= cmet.ImplementedInterfaceMembers.Any(m => IsImplementation (m, method));

						if (CompareMembers(method, cmet)) {
							if (!needsExplicitly && !cmet.ReturnType.Equals(method.ReturnType))
								needsExplicitly = true;
							else
								alreadyImplemented |= !needsExplicitly /*|| cmet.InterfaceImplementations.Any (impl => impl.InterfaceType.Equals (interfaceType))*/;
						}
					}
					if (toImplement.Where(t => t.Item1 is IMethod).Any(t => CompareMembers(method, (IMethod)t.Item1)))
						needsExplicitly = true;
					if (!alreadyImplemented) {
						toImplement.Add(new Tuple<IMember, bool>(method, needsExplicitly));
					} else {
						interfaceMissing = false;
					}
				}
			
			// Stub out non-implemented properties defined by @iface
			foreach (var propGroup in interfaceType.GetProperties (p => !p.IsSynthetic).GroupBy (m => m.DeclaringType).Reverse ())
				foreach (var prop in propGroup) {
					if (prop.DeclaringType.Kind != TypeKind.Interface)
						continue;

					bool needsExplicitly = explicitly;
					alreadyImplemented = implementingType.GetMembers().Any(m => m.ImplementedInterfaceMembers.Any(im => IsImplementation (im, prop)));

					foreach (var t in implementingType.GetAllBaseTypeDefinitions ()) {
						if (t.Kind == TypeKind.Interface) {
							foreach (var cprop in t.Properties) {
								if (cprop.Name == prop.Name && cprop.IsShadowing) {
									if (!needsExplicitly && !cprop.ReturnType.Equals(prop.ReturnType))
										needsExplicitly = true;
								}
							}
							continue;
						}
						foreach (var cprop in t.Properties) {
							if (cprop.Name == prop.Name) {
								if (!needsExplicitly && !cprop.ReturnType.Equals(prop.ReturnType))
									needsExplicitly = true;
								else
									alreadyImplemented |= !needsExplicitly/* || cprop.InterfaceImplementations.Any (impl => impl.InterfaceType.Resolve (ctx).Equals (interfaceType))*/;
							}
						}
					}
					if (!alreadyImplemented) {
						toImplement.Add(new Tuple<IMember, bool>(prop, needsExplicitly));
					} else {
						interfaceMissing = false;
					}
				}
			return toImplement;
		}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:85,代码来源:ImplementInterfaceAction.cs


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