Udostępnij za pośrednictwem


Metoda FileCodeModel2.Remove — (Object)

Usuwa element określony kod z pliku źródłowego.

Przestrzeń nazw:  EnvDTE80
Zestaw:  EnvDTE80 (w EnvDTE80.dll)

Składnia

'Deklaracja
Sub Remove ( _
    Element As Object _
)
void Remove(
    Object Element
)
void Remove(
    Object^ Element
)
abstract Remove : 
        Element:Object -> unit 
function Remove(
    Element : Object
)

Parametry

  • Element
    Typ: System.Object
    Wymagane.A CodeElement obiektu lub nazwę elementu kodu, aby usunąć z kodu źródłowego.

Uwagi

Elementmoże to być albo CodeElement obiekt w kolekcji lub nazwę unikatowy element w kolekcji.

Poszczególne elementy nie zostały Remove metody, ponieważ istnieją wiele kolekcji.Aby usunąć określony element, należy wywołać Remove metoda własnego obiektu kontenera.

Przykłady

Sub RemoveExample(ByVal dte As DTE2)

    ' Before running this example, open a code document from a project
    ' and place the insertion point inside a function.
    Try
        ' Retrieve the CodeFunction at the insertion point.
        Dim sel As TextSelection = _
            CType(dte.ActiveDocument.Selection, TextSelection)
        Dim fun As CodeFunction = _
            CType(sel.ActivePoint.CodeElement( _
            vsCMElement.vsCMElementFunction), CodeFunction)

        If MsgBox("Remove " & fun.Name & "?", MsgBoxStyle.YesNo) = _
            MsgBoxResult.Yes Then
            ' Remove the function.
            fun.ProjectItem.FileCodeModel.Remove(fun)
        End If
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

End Sub

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

FileCodeModel2 Interfejs

Przeciążenie Remove

Przestrzeń nazw EnvDTE80

Inne zasoby

Jak: skompilować i uruchomić przykłady kodu modelu obiektu automatyzacji