Implement() protected abstract method

/// The language does not support explicit interface implementation. /// /// is null.-or- /// is null. ///
protected abstract Implement ( Operation operation, CompositeType newParent, bool explicitly ) : Operation
operation Operation
newParent CompositeType
explicitly bool
return Operation
示例#1
0
        /// <exception cref="ArgumentException">
        /// The language of <paramref name="operation"/> does not equal.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="operation"/> is null.
        /// </exception>
        public Operation Implement(Operation operation, bool explicitly)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            if (operation.Language != this.Language)
            {
                throw new ArgumentException(Strings.GetString("error_languages_do_not_equal"));
            }

            if (!(operation.Parent is InterfaceType))
            {
                throw new ArgumentException("The operation is not a member of an interface.");
            }

            if (explicitly && !operation.Language.SupportsExplicitImplementation)
            {
                throw new ArgumentException(Strings.GetString(
                                                "error_explicit_implementation"), "explicitly");
            }

            Operation newOperation = Language.Implement(this, operation, explicitly);

            newOperation.Parent = this;

            AddOperation(newOperation);
            return(newOperation);
        }
示例#2
0
        /// <exception cref="ArgumentException">
        ///     The language of <paramref name="operation" /> does not equal.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="operation" /> is null.
        /// </exception>
        public Operation Implement(Operation operation, bool explicitly)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            if (operation.Language != Language)
            {
                throw new ArgumentException(Strings.ErrorLanguagesDoNotEqual);
            }

            if (!(operation.Parent is InterfaceType))
            {
                throw new ArgumentException("The operation is not a member of an interface.");
            }

            if (explicitly && !operation.Language.SupportsExplicitImplementation)
            {
                throw new ArgumentException(
                          Strings.ErrorExplicitImplementation,
                          "explicitly");
            }

            var newOperation = Language.Implement(operation, this, explicitly);

            newOperation.Parent = this;

            AddOperation(newOperation);
            return(newOperation);
        }