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

Poznámky

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

Jednotlivé prvky nemají RemoveParameter Metoda protože mohou existovat ve více kolekcích. Chcete-li odebrat určitého prvku, musíte zavolat Remove Metoda jeho objektu kontejneru.

Poznámka

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 Discovering Code by Using the Code Model (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é

Odkaz

CodeFunction Rozhraní

EnvDTE – obor názvů

Další zdroje

How to: Compile and Run the Automation Object Model Code Examples

Discovering Code by Using the Code Model (Visual Basic)

Discovering Code by Using the Code Model (Visual C#)