共用方式為


Reference3.Culture 屬性

取得參考的文化特性字串。

命名空間:  VSLangProj80
組件:  VSLangProj80 (在 VSLangProj80.dll 中)

語法

'宣告
ReadOnly Property Culture As String
string Culture { get; }
property String^ Culture {
    String^ get ();
}
abstract Culture : string
function get Culture () : String

屬性值

型別:System.String
視參考型別而定傳回不同值。

參考型別

傳回值

Assembly

文化字串。例如,美式英語為 "EN-US"。

COM

地區設定 ID。此字串是參考的型別程式庫的十六進位地區設定 ID。例如,"0" 是多國語言,"409" 是美式英語。

備註

文化資訊包含語言和日曆規格。如需有效字串的相關資訊,請參閱 CultureInfo

範例

此範例會針對開啟之 Visual Basic 或 Visual C# 專案中的每個參考,顯示其文化特性 (Culture) 值。若要將此範例當做增益集來執行,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例。如需其他範例,請參閱 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());
    }
}

.NET Framework 安全性

請參閱

參考

Reference3 介面

Culture 多載

VSLangProj80 命名空間