Partager via


ResourcesAttribute Class

The ResourcesAttribute class is derived from Object.Attribute and is used for specifying how a property should be localized.

System.Object

      System.Attribute

            ResourcesAttribute

Public Constructors

The following table shows the constructors of the ResourcesAttribute class and a brief description of each.

Name Description
ResourcesAttribute Initializes a new instance of the ResourcesAttribute class.
ResourcesAttribute Initializes a new instance of the ResourcesAttribute class.

Public Fields

The following table shows the fields of the ResourcesAttribute class with a brief description of each.

Name Description
Undefined Value returned if the ResourcesAttribute isn't defined.

Public Properties

The following table shows the properties of the ResourcesAttribute class, the data type of each property, and a brief description of each.

Name Data type Description
Category String A resource ID representing the localized category name of the property.
Description String A resource ID representing the localized description of the property.
Name String A resource ID representing the localized name of the property.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

At run time, the CustomPropertyToolPart looks for the ResourcesAttribute class. If found, the CustomPropertyToolPart iterates through the LoadResource method (you must override this method) with the resource values from the ResourcesAttribute. If the resource cannot be found, the CustomPropertyToolPart user interface is built with the default values. Otherwise, the CustomPropertyToolPart user interface is built with the localized values. The Microsoft .NET Framework will only provide localization values for the Property label, descriptions, and Category label. The base property name will not be localized. If the ResourcesAttribute class isn't defined, the CustomPropertyToolPart user interface will revert back to the non-localized metadata (that is, CategoryAttribute, DescriptionAttribute, FriendlyNameAttribute, and the internal name of the property).

Example

The following code example demonstrates how to localize your custom property when displayed in the CustomPropertyToolPart user interface.

Requirements

Namespace: Microsoft.SharePoint.WebPartPages

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security