مشاركة عبر


FileCodeModel.Remove أسلوب

قم بإزالة الفرعي تعليمات برمجية العنصر من الملف المصدر.

مساحة الاسم:  EnvDTE
التجميع:  EnvDTE (في EnvDTE.dll)

بناء الجملة

'إقرار
Sub Remove ( _
    Element As Object _
)
void Remove(
    Object Element
)
void Remove(
    Object^ Element
)
abstract Remove : 
        Element:Object -> unit 
function Remove(
    Element : Object
)

المعلمات

  • Element
    النوع: System.Object
    مطلوبة.CodeElementالكائن أو اسم عنصر تعليمات برمجية إلى إزالة من تعليمات برمجية المصدر.

ملاحظات

Elementيمكن أن تكون أماCodeElementكائن في المجموعة، أو اسم عنصر فريد في المجموعة.

لم يكن عناصر فردية Removeأسلوب سبب وجودها في عدة مجموعات. إلى إزالة عنصر معين، يجب استدعاء Removeأسلوب للكائن الحاوية الخاصة به.

أمثلة

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

أمن NET Framework.

راجع أيضًَا

المرجع

FileCodeModel واجهة

FileCodeModel الأعضاء

EnvDTE مساحة الاسم

موارد أخرى

كيفية: الترجمة وإعادة تشغيل أمثلة التعليمات البرمجية لطراز كائن التنفيذ التلقائي