Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Removes an imports statement from the Imports collection. The imports statement to be removed may be indexed by either the string specifying the import or by a one-based index.
Namespace: VSLangProj
Assembly: VSLangProj (in VSLangProj.dll)
Syntax
'Declaration
Sub Remove ( _
index As Object _
)
void Remove(
Object index
)
void Remove(
[InAttribute] Object^ index
)
abstract Remove :
index:Object -> unit
function Remove(
index : Object
)
Parameters
index
Type: ObjectRequired. Either a one-based index into the collection, or the imports statement string to remove.
Remarks
An error is generated if the imports statement does not exist in the collection. If you use a string index, the string must be an exact match for the imports statement. For example, an index of "SomeNamespace" will not remove the imports statement "SomeNamespace.*".
Examples
' Macro Editor
Imports VSLangProj
Public Sub RemoveImport()
' Project must be a Visual Basic project.
Try
Dim vsproject As VSProject = _
CType(DTE.Solution.Projects.Item(1).Object, VSProject)
vsproject.Imports.Remove("SomeAlias = SomeNamespace.*")
vsproject.Imports.Remove(1)
Catch e As System.Exception
MsgBox(e.Message)
End Try
End Sub
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.