Compartir a través de


CodeFunction.RemoveParameter (Método)

Quita un parámetro de la lista de argumentos.

Espacio de nombres:  EnvDTE
Ensamblado:  EnvDTE (en EnvDTE.dll)

Sintaxis

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

Parámetros

Comentarios

Element puede ser un objeto CodeElement de la colección o el nombre de un elemento único de la colección.

Los elementos individuales no tienen un método RemoveParameter porque pueden existir en varias colecciones. Para quitar un elemento específico, deberá llamar al método Remove correspondiente a su objeto contenedor.

Nota

Los valores de los elementos de modelo de código como clases, structs, funciones, atributos, delegados, etc., pueden ser no deterministas una vez realizados determinados tipos de modificaciones; esto significa que no se puede confiar en que sus valores se mantengan siempre igual. Para obtener más información, vea la sección Los valores de elementos de modelo de código pueden cambiar, en Detectar código utilizando el modelo de código (Visual Basic).

Ejemplos

 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);
    }
}

Seguridad de .NET Framework

Vea también

Referencia

CodeFunction Interfaz

EnvDTE (Espacio de nombres)

Otros recursos

Cómo: Compilar y ejecutar los ejemplos de código del modelo de objetos de automatización

Detectar código utilizando el modelo de código (Visual Basic)

Detectar código utilizando el modelo de código (Visual C#)