SPUserResource.Value Property

Gets or sets the value of the resource for the thread's culture.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

public string Value { get; set; }

Property Value

Type: System.String
A string that contains the value for the CurrentUICulture property of the current thread. If the resource has not been translated for that culture, or if that culture is not supported by the Web site, the value for the Web site's default culture is used.

The following example is a console application that demonstrates how the value of the Value property can change depending on the culture of the current thread. The application enumerates the list of cultures supported by a Web site, sets the thread's CurrentUICulture to each supported culture, and prints the value of the user resource for the title of the Announcements list in the language of the thread's CurrentUICulture.

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("http://localhost"))
            {
                using (SPWeb web = site.RootWeb)
                {
                    SPList list = web.Lists.TryGetList("Announcements");
                    if (list != null)
                    {
                        SPUserResource resource = list.TitleResource;
                        foreach (CultureInfo culture in web.SupportedUICultures)
                        {
                            Thread.CurrentThread.CurrentUICulture = culture;
                            Console.WriteLine("{0}: {1}", culture.Name, resource.Value);
                        }
                    }
                }
            }
            Console.Write("\nPress ENTER to continue....");
            Console.Read();
        }
    }
}
Show: