共用方式為


SPRegionalSettings.Locales property

會取得使用伺服器陣列中的地區設定的集合。

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public ReadOnly Property Locales As SPLocaleCollection
    Get
'用途
Dim instance As SPRegionalSettings
Dim value As SPLocaleCollection

value = instance.Locales
public SPLocaleCollection Locales { get; }

Property value

Type: Microsoft.SharePoint.SPLocaleCollection
SPLocaleCollection 物件,代表地區設定。

Examples

下列程式碼範例會顯示的所有地區設定顯示在根網站。

Dim siteCollection As New SPSite("https://localhost")
Try
    Dim rootWebSite As SPWeb = siteCollection.RootWeb
    Dim regionalsettings As SPRegionalSettings = rootWebSite.RegionalSettings
    Dim locales As SPLocaleCollection = regionalsettings.Locales

    Dim local As SPLocale
    For Each local In  locales
        Console.WriteLine(local.DisplayName)
    Next local

    rootWebSite.Dispose()
Finally
    siteCollection.Dispose()
End Try
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
    using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
    {
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
        SPLocaleCollection collLocalesAvailable = oRegionalSettings.Locales;

        foreach (SPLocale oLocaleAvailable in collLocalesAvailable)
        {
            Console.WriteLine(oLocaleAvailable.DisplayName);
        }
    }
}
注意事項注意事項

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

請參閱

參照

SPRegionalSettings class

SPRegionalSettings members

Microsoft.SharePoint namespace