Sdílet prostřednictvím


CodeFunction.RemoveParameter – metoda

Parametr odebere ze seznamu argumentů.

Obor názvů:  EnvDTE
Sestavení:  EnvDTE (v EnvDTE.dll)

Syntaxe

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

Parametry

  • Element
    Typ: Object

    Povinné.A CodeElement objektu nebo názvem jedné v kolekci.

Poznámky

Elementlze buď CodeElement objekt, který je v kolekci nebo název prvku, který je jedinečný v rámci kolekce.

Jednotlivé prvky nemají RemoveParameter metoda protože mohou existovat několik kolekcí.Chcete-li odebrat určitého prvku, musíte zavolat Remove metoda objektu kontejneru.

[!POZNÁMKA]

Není deterministický může být po provedení určité typy úprav, což znamená, že jejich hodnoty nelze dovolávat vždy zůstat stejné hodnoty prvků modelu kód jako třídy, struktury, funkce, atributy, delegátů a tak dále.Další informace naleznete v části Změna hodnoty prvku modelu kódu Zjišťování kódu pomocí modelu kódu (Visual Basic).

Příklady

 Sub RemoveParameterExample(ByVal dte As DTE2)

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

        If MsgBox("Remove " & param.Name & " from " & fun.Name & "?", _
            MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            fun.RemoveParameter(param)
        End If
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

End Sub
 public void RemoveParameterExample(DTE2 dte)
{
    // Before running this example, open a code document from a project
    // and place the insertion point inside a function parameter.
    try
    {
        // Retrieve the CodeParameter at the insertion point.
        TextSelection sel = 
            (TextSelection)dte.ActiveDocument.Selection;
        CodeParameter param = 
            (CodeParameter)sel.ActivePoint.get_CodeElement(
            vsCMElement.vsCMElementParameter);
        CodeFunction fun = (CodeFunction)param.Parent;

        if (MessageBox.Show("Remove " + param.Name + " from " + 
            fun.Name + "?", "", MessageBoxButtons.YesNo) == 
            DialogResult.Yes)
            fun.RemoveParameter(param);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Zabezpečení rozhraní .NET Framework

Viz také

Referenční dokumentace

CodeFunction Rozhraní

EnvDTE – obor názvů

Další zdroje

Postupy: Kompilace a spuštění příkladů kódu objektu automatizace

Zjišťování kódu pomocí modelu kódu (Visual Basic)

Zjišťování kódu pomocí modelu kódu (Visual C#)