共用方式為


SPList.TitleResource property

取得SPUserResource物件,代表標題翻譯的清單。

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

Syntax

'宣告
Public ReadOnly Property TitleResource As SPUserResource
    Get
'用途
Dim instance As SPList
Dim value As SPUserResource

value = instance.TitleResource
public SPUserResource TitleResource { get; }

Property value

Type: Microsoft.SharePoint.SPUserResource
封裝使用者定義的可當地語系化資源的物件。

備註

此屬性是Title屬性,會傳回TitleResource.Value所傳回的字串的來源。此運算式所傳回的值可以會根據目前的執行緒CurrentUICulture的值而有所不同。如需詳細資訊,請參閱 < SPUserResource.Value屬性。

Examples

下列範例會示範如何相關的TitleResource屬性和Title屬性,以及如何根據目前的執行緒的文化特性變更其值的主控台應用程式。應用程式列舉網站所支援的文化特性的清單,並將目前的執行緒Thread.CurrentUICulture屬性設定為每個支援的文化特性。應用程式接著會列印TitleResource屬性和語言的執行緒CurrentUICulture的宣告清單的Title屬性的值。

using System;
using System.Globalization;
using System.Threading;
using Microsoft.SharePoint;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://localhost"))
            {
                using (SPWeb web = site.RootWeb)
                {
                    SPList list = web.Lists.TryGetList("Announcements");
                    if (list != null)
                    {
                        string formatString = "{0, -20} {1, -20} {2}";
                        Console.WriteLine(formatString, "CurrentUICulture", "TitleResource", "Title");

                        SPUserResource resource = list.TitleResource;
                        foreach (CultureInfo culture in web.SupportedUICultures)
                        {
                            Thread.CurrentThread.CurrentUICulture = culture;
                            Console.WriteLine(formatString, culture.Name, resource.Value, list.Title);
                        }
                    }
                }
            }
            Console.Write("\nPress ENTER to continue....");
            Console.Read();
        }
    }
}
Imports System
Imports System.Globalization
Imports System.Threading
Imports Microsoft.SharePoint

Module ConsoleApp

    Sub Main()
        Using site As New SPSite("https://localhost")
            Using web As SPWeb = site.OpenWeb()

                Dim list As SPList = web.Lists.TryGetList("Announcements")
                If list IsNot Nothing Then

                    Dim formatString As String = "{0, -20} {1, -20} {2}"
                    Console.WriteLine(formatString, "CurrentUICulture", "TitleResource", "Title")

                    Dim resource As SPUserResource = list.TitleResource
                    For Each culture As CultureInfo In web.SupportedUICultures

                        Thread.CurrentThread.CurrentUICulture = culture
                        Console.WriteLine(formatString, culture.Name, resource.Value, list.Title)

                    Next

                End If

            End Using
        End Using
        Console.Write(vbCrLf & "Press ENTER to continue....")
        Console.Read()
    End Sub

End Module

請參閱

參照

SPList class

SPList members

Microsoft.SharePoint namespace

Title

UserResources