ExtendedProperties.Remove(Object) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Supprime un objet ExtendedProperty de la collection ExtendedProperties.
public:
void Remove(System::Object ^ index);
public void Remove (object index);
member this.Remove : obj -> unit
Public Sub Remove (index As Object)
Paramètres
- index
- Object
Nom, index, ID ou description de l'objet ExtendedProperty à supprimer.
Exemples
L’exemple suivant supprime une propriété étendue de la collection à l’aide de l’ID.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace ExtendedProperties_Testing
{
class Program
{
static void Main(string[] args)
{
// The package is one of the SSIS samples.
string mySample = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";
// Create the application, and load the sample.
Application app = new Application();
Package pkg = app.LoadPackage(mySample, null);
// Get the Extended properties collection from the package.
ExtendedProperties myExtProps = pkg.ExtendedProperties;
// Give the count of the number of extended properties.
int numProps = myExtProps.Count;
Console.WriteLine("Current number of extended properties: {0}", numProps);
// Remove an extended property.
myExtProps.Remove("{A56842E2-11C1-487E-B670-33F25B534146}");
// Give the new count of the number of extended properties.
numProps = myExtProps.Count;
Console.WriteLine("New number of extended properties: {0}", numProps);
Console.WriteLine();
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace ExtendedProperties_Testing
Class Program
Shared Sub Main(ByVal args() As String)
' The package is one of the SSIS samples.
Dim mySample As String = "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"
' Create the application, and load the sample.
Dim app As Application = New Application()
Dim pkg As Package = app.LoadPackage(mySample,Nothing)
' Get the extended properties collection from the package.
Dim myExtProps As ExtendedProperties = pkg.ExtendedProperties
' Give the count of the number of extended properties.
Dim numProps As Integer = myExtProps.Count
Console.WriteLine("Current number of extended properties: {0}", numProps)
' Remove an extended property.
myExtProps.Remove("{A56842E2-11C1-487E-B670-33F25B534146}")
' Give the new count of the number of extended properties.
numProps = myExtProps.Count
Console.WriteLine("New number of extended properties: {0}", numProps)
Console.WriteLine()
End Sub
End Class
End Namespace
Exemple de sortie :
Nombre actuel de propriétés étendues : 7
Nouveau nombre de propriétés étendues : 6