Reference3.Isolated Propriété

Définition

Obtient ou définit l'information indiquant si la référence COM est isolée, autrement dit si elle n'est pas inscrite auprès de Windows.

public:
 property bool Isolated { bool get(); void set(bool value); };
public:
 property bool Isolated { bool get(); void set(bool value); };
[System.Runtime.InteropServices.DispId(122)]
public bool Isolated { [System.Runtime.InteropServices.DispId(122)] get; [System.Runtime.InteropServices.DispId(122)] set; }
[<System.Runtime.InteropServices.DispId(122)>]
[<get: System.Runtime.InteropServices.DispId(122)>]
[<set: System.Runtime.InteropServices.DispId(122)>]
member this.Isolated : bool with get, set
Public Property Isolated As Boolean

Valeur de propriété

Boolean

Valeur booléenne indiquant si la référence est isolée.

Attributs

Exemples

Cet exemple ajoute une référence COM à un Visual Basic projet Open ou Visual C# Project et affiche sa Isolated propriété. 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 (spcommon.dll) sont : <installation root> \Program Files\Common Files\SpeechEngines\Microsoft. 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)  
    GetIsolatedValue(applicationObject)  
End Sub  
Sub GetIsolatedValue(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 identity.  
    Dim newRef As Reference3  
    ' Add a COM reference and display its isolation value.  
    ' Replace the <file path> with an actual file path.  
    newRef = CType(aVSProject.References.Add_  
("<file path>\spcommon.dll"), Reference3)  
    MsgBox("Added a COM reference, named: " & newRef.Name)  
    MsgBox("The Isolated value of " & newRef.Name & " is "   
    & newRef.Isolated.ToString())  
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;  
    GetIsolatedValue(((DTE2)applicationObject));  
}  
public void GetIsolatedValue(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 a COM reference and display its isolated value.  
    // Replace <file path> with an actual file path.  
    aRef = (Reference3)vsProject.References.Add  
((@"<file path>\spcommon.dll"));  
    MessageBox.Show("Added a COM reference, named: " + aRef.Name);  
    MessageBox.Show("The isolated value of " + aRef.Name + " is "   
+ aRef.Isolated.ToString());  
}  

S’applique à