Exemplo n.º 1
0
        public CodeInterface AddInterface(string Name, object Position, object Bases, vsCMAccess Access)
        {
            CodeDomCodeInterface ci = new CodeDomCodeInterface(DTE, this, Name, Bases, Access);

            AddItem <CodeTypeDeclaration>(ci.CodeObject, Position);

            return(ci);
        }
Exemplo n.º 2
0
        /// <summary>
        /// AddImplementedInterface adds a reference to an interface that the CodeClass promises to implement. AddImplementedInterface does not insert method stubs for the interface members.
        /// </summary>
        /// <param name="Base">Required. The interface the class will implement. This is either a CodeInterface or a fully qualified type name.</param>
        /// <param name="Position">Optional. Default = 0. The code element after which to add the new element. If the value is a CodeElement, then the new element is added immediately after it.
        ///
        /// If the value is a Long data type, then AddImplementedInterface indicates the element after which to add the new element.
        ///
        /// Because collections begin their count at 1, passing 0 indicates that the new element should be placed at the beginning of the collection. A value of -1 means the element should be placed at the end.
        /// </param>
        /// <returns>A CodeInterface object. </returns>
        public CodeInterface AddImplementedInterface(object Base, object Position)
        {
            CodeTypeReference    ctr;
            CodeDomCodeInterface iface = Base as CodeDomCodeInterface;

            if (iface != null)
            {
                ctr = new CodeTypeReference(iface.FullName);
            }
            else
            {
                ctr = new CodeTypeReference((string)Base);
            }

            CodeObject.BaseTypes.Insert(PositionToInterfaceIndex(Position), ctr);

            CommitChanges();

            return(new CodeDomCodeInterface(DTE, this, ctr.BaseType, System.Reflection.Missing.Value, vsCMAccess.vsCMAccessDefault));
        }