CodeFunction.RemoveParameter(Object) Method

Definition

Removes a parameter from the argument list.

C++/CX
public:
 void RemoveParameter(Platform::Object ^ Element);

Parameters

Element
Object

Required. A CodeElement object or the name of one in the collection.

Attributes

Examples

VB
 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  

Remarks

Element can either be a CodeElement object that is in the collection, or the name of an element that is unique within the collection.

Individual elements do not have a RemoveParameter method because they can exist in multiple collections. To remove a specific element, you must call the Remove method of its container object.

Napomena

The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

Applies to

Proizvod Verzije
Visual Studio SDK 2015, 2017, 2019, 2022