Reference3.SubType Propriété

Définition

Définit ou obtient le sous-type d'assembly.

public:
 property System::String ^ SubType { System::String ^ get(); void set(System::String ^ value); };
public:
 property Platform::String ^ SubType { Platform::String ^ get(); void set(Platform::String ^ value); };
[System.Runtime.InteropServices.DispId(121)]
public string SubType { [System.Runtime.InteropServices.DispId(121)] get; [System.Runtime.InteropServices.DispId(121)] set; }
[<System.Runtime.InteropServices.DispId(121)>]
[<get: System.Runtime.InteropServices.DispId(121)>]
[<set: System.Runtime.InteropServices.DispId(121)>]
member this.SubType : string with get, set
Public Property SubType As String

Valeur de propriété

String

Une valeur de chaîne qui représente le sous-type de l'assembly. Pour les projets SQL Server Visual Basic ou Visual C#, cette propriété a la valeur SQLCLR si la référence a été récupérée à partir du serveur SQL cible.

Attributs

Exemples

Cet exemple ajoute une référence à un Visual Basic projet Open ou Visual C# Project et affiche le sous-type de référence, s’il en existe un. Pour exécuter cet exemple en tant que complément, consultez Comment : compiler et exécuter les exemples de code du modèle objet Automation.

Les chemins d’accès par défaut pour la référence ajoutée sont : <drive> : \Program Files\Microsoft SQL Server\90\COM. Remplacez <file path> dans l’exemple par ce chemin d’accès de fichier approprié ou un autre.

Imports VSLangProj  
Imports VSLangProj2  
Imports VSLangProj80  
Public Sub OnConnection(ByVal application As Object, _  
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _  
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection  
    applicationObject = CType(application, DTE2)  
    addInInstance = CType(addInInst, AddIn)  
    DisplaySubType(applicationObject)  
End Sub  
Sub DisplaySubType(ByVal dte As DTE2)  
    Dim aProject As Project  
    Dim aVSProject As VSProject2  
    aProject = applicationObject.Solution.Projects.Item(1)  
    aVSProject = _  
    CType(applicationObject.Solution.Projects.Item(1).Object, _  
    VSProject2)  
    ' Add an Assembly reference and display its subtype.  
    Dim newRef As Reference3  
    ' Replace <file path> with an actual file path.  
    newRef = CType(aVSProject.References.Add _  
("<file path>\sqldistx.dll "), Reference3)  
    MsgBox("Added an assembly reference, named: " & newRef.Name)  
    MsgBox("The SubType of " & newRef.Name & " is " _  
    & newRef.SubType)  
End Sub  
using System.Windows.Forms;  
using VSLangProj;  
using VSLangProj2;  
using VSLangProj80;  
public void OnConnection(object application,  
 ext_ConnectMode connectMode, object addInInst, ref Array custom)  
{  
    applicationObject = (DTE2)application;  
    addInInstance = (AddIn)addInInst;  
    DisplaySubType(((DTE2)applicationObject));  
}  
public void DisplaySubType(DTE2 dte)  
{  
    // The first project is a Visual Basic or C# project.  
VSProject2 vsProject =  
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));  
    Reference3 aRef = null;  
    // Add an Assembly reference and display its subtype.  
    // Replace <file path> with an actual file path.  
    aRef = (Reference3)vsProject.References.Add  
((@"<file path>\sqldistx.dll"));  
    MessageBox.Show("Added reference, named: "  
+ aRef.Name);  
MessageBox.Show("The SubType of " + aRef.Name + " is "  
+ aRef.SubType);  
}  

Remarques

Cette propriété est utile uniquement pour les SQL Server Visual Basic ou les Visual C# projets.

S’applique à