ICSharpCode.NRefactory.MonoCSharp.InterfaceMemberBase.Define C# (CSharp) Method

Define() public method

public Define ( ) : bool
return bool
		public override bool Define ()
		{
			if (IsInterface) {
				ModFlags = Modifiers.PUBLIC | Modifiers.ABSTRACT |
					Modifiers.VIRTUAL | (ModFlags & (Modifiers.UNSAFE | Modifiers.NEW));

				flags = MethodAttributes.Public |
					MethodAttributes.Abstract |
					MethodAttributes.HideBySig |
					MethodAttributes.NewSlot |
					MethodAttributes.Virtual;
			} else {
				Parent.PartialContainer.MethodModifiersValid (this);

				flags = ModifiersExtensions.MethodAttr (ModFlags);
			}

			if (IsExplicitImpl) {
				InterfaceType = MemberName.ExplicitInterface.ResolveAsType (Parent);
				if (InterfaceType == null)
					return false;

				if ((ModFlags & Modifiers.PARTIAL) != 0) {
					Report.Error (754, Location, "A partial method `{0}' cannot explicitly implement an interface",
						GetSignatureForError ());
				}

				if (!InterfaceType.IsInterface) {
					Report.SymbolRelatedToPreviousError (InterfaceType);
					Report.Error (538, Location, "The type `{0}' in explicit interface declaration is not an interface",
						InterfaceType.GetSignatureForError ());
				} else {
					Parent.PartialContainer.VerifyImplements (this);
				}

				Modifiers allowed_explicit = Modifiers.AllowedExplicitImplFlags;
				if (this is Method)
					allowed_explicit |= Modifiers.ASYNC;

				ModifiersExtensions.Check (allowed_explicit, explicit_mod_flags, 0, Location, Report);
			}

			return base.Define ();
		}