FileCodeModel2.Remove(Object) Método

Definição

Remove o elemento de código especificado do arquivo de origem.

public:
 void Remove(System::Object ^ Element);
public:
 void Remove(Platform::Object ^ Element);
void Remove(winrt::Windows::Foundation::IInspectable const & Element);
[System.Runtime.InteropServices.DispId(16)]
public void Remove (object Element);
[<System.Runtime.InteropServices.DispId(16)>]
abstract member Remove : obj -> unit
Public Sub Remove (Element As Object)

Parâmetros

Element
Object

Obrigatórios. Um CodeElement objeto ou o nome de um elemento de código a ser removido do código-fonte.

Implementações

Atributos

Exemplos

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  

Comentários

Element pode ser um CodeElement objeto na coleção ou o nome de um elemento exclusivo na coleção.

Os elementos individuais não têm um Remove método porque podem existir em várias coleções. Para remover um elemento específico, você deve chamar o Remove método de seu objeto de contêiner.

Aplica-se a