NClass.Core.InterfaceType.IsAncestor C# (CSharp) Method

IsAncestor() private method

private IsAncestor ( InterfaceType _interface ) : bool
_interface InterfaceType
return bool
		private bool IsAncestor(InterfaceType _interface)
		{
			foreach (InterfaceType baseInterface in baseList) {
				if (baseInterface.IsAncestor(_interface))
					return true;
			}
			return (_interface == this);
		}

Usage Example

示例#1
0
        /// <exception cref="RelationException">
        /// The language of <paramref name="_base"/> does not equal.-or-
        /// <paramref name="_base"/> is earlier added base.-or-
        /// <paramref name="_base"/> is descendant of the interface.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="_base"/> is null.
        /// </exception>
        internal void AddBase(InterfaceType _base)
        {
            if (_base == null)
            {
                throw new ArgumentNullException("_base");
            }

            if (BaseList.Contains(_base))
            {
                throw new RelationException(
                          Strings.GetString("error_cannot_add_same_base_interface"));
            }
            if (_base.IsAncestor(this))
            {
                throw new RelationException(Strings.GetString("error_cyclic_base",
                                                              Strings.GetString("interface")));
            }

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

            BaseList.Add(_base);
            Modified();
        }
All Usage Examples Of NClass.Core.InterfaceType::IsAncestor