Export (0) Print
Expand All

DisplayAttribute.Description Property

Gets or sets either a resource name or non-localized text, such as a tool tip, that is displayed to users to help them understand a member.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public string Description { get; set; }

Property Value

Type: System.String
Either a resource name or the non-localized text to display to users to help them understand a member. The resource name is used with the ResourceType property to retrieve localized text to display to users to help them understand a member.

Set the Description property to either a literal non-localized string or to a resource name to use with the ResourceType property to retrieve localized text.

Do not use the get accessor of the Description property to retrieve the text to display in your Silverlight application. Instead, use the GetDescription method to retrieve the description to display. The GetDescription method returns either the literal non-localized string or the localized string when a resource type has been specified.

The following example shows how to use the DisplayAttribute attribute to set both localized and non-localized display values. A property named EmailAddress includes non-localized display values and a property named LastName includes localized display values that are retrieved from a resource type named DisplayResources.


public class Customer
{
  [Display(Name = "Email Address", 
     Description = "An email address is needed to provide notifications about the order.")]
  public string EmailAddress { get; set; }

  [Display(ResourceType=typeof(DisplayResources), Name="LName", Description="LNameDescription")]
  public string LastName { get; set; }
}


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft