Condividi tramite


Reference3.Culture Property

Definition

Gets the culture string of a reference.

public:
 property System::String ^ Culture { System::String ^ get(); };
public:
 property Platform::String ^ Culture { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(10)]
public string Culture { [System.Runtime.InteropServices.DispId(10)] get; }
[<System.Runtime.InteropServices.DispId(10)>]
[<get: System.Runtime.InteropServices.DispId(10)>]
member this.Culture : string
Public ReadOnly Property Culture As String

Property Value

The return value depends on the reference type.Reference TypeValue ReturnedAssemblyCulture string. For example, "EN-US" for English - United States.COMLocale ID. The string is the hex locale ID of the type library being referenced. For example, "0" for multilanguage or "409" for English - United States.

Implements

Attributes

Examples

This example displays the culture value of each reference in an open Visual Basic or Visual C# project. To run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples. For an additional example, see Reference3.

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)  
    DisplayCultures(applicationObject)  
End Sub  
Public Sub DisplayCultures(ByVal dte As DTE2)  
    ' The first project is a Visual Basic or C# project.  
    Dim vsProject As VSProject2 = _  
    CType(dte.Solution.Projects.Item(1).Object, VSProject2)  
    Dim aRef As Reference3  
    For Each aRef In vsProject.References  
        MsgBox(aRef.Name & " has a culture value of: " _  
        & aRef.Culture.ToString())  
    Next  
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;  
    DisplayCultures(((DTE2)applicationObject));  
}  

public void DisplayCultures(DTE2 dte)  
{  
    // The first project is a Visual Basic or C# project.  
    VSProject2 vsProject =  
 ((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));  
    Reference3 aRef = null;  
    foreach (VSLangProj80.Reference3 temp in vsProject.References)  
    {  
        aRef = temp;  
         MessageBox.Show(aRef.Name + " has a culture value of: "   
+ aRef.Culture.ToString());  
    }  
}  

Remarks

Culture information includes language and calendar specifications. For information about valid strings, see CultureInfo.

Applies to