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
返回值取决于引用类型。

引用类型

返回的值

程序集

“区域性”字符串。例如,“EN-US”代表“美国英语”。

COM

区域设置 ID。该字符串是引用的类型库的十六进制区域设置 ID。例如,“0”代表多语言,“409”代表“美国英语”。

备注

区域性信息包括语言和日历规范。有关有效字符串的信息,请参见 CultureInfo

示例

此示例显示打开的 Visual Basic 或 Visual C# 项目中每个引用的区域性值。若要将此示例作为外接程序运行,请参见如何:编译和运行自动化对象模型代码示例。有关其他示例,请参见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 命名空间