Skip to content

DisplayAttribute string properties: Remarks incorrectly state the property performs resource lookup #13023

Description

@xsainteer

Type of issue

Other (describe below)

Description

The Remarks section on ShortName currently states that the property returns the
localized string when ResourceType is specified and the value represents a resource key.

That describes GetShortName(), not the property. The property getter returns the #raw
value — either a literal string or a resource key — and performs no lookup.

The summary of DisplayAttribute.ShortName that says that ShortName may be a resource key string:

Image

DisplayAttribute.Name docs do highlight that it may be a resource key string and suggest to use GetName() for UI:

Image

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.displayattribute.shortname?view=net-5.0#system-componentmodel-dataannotations-displayattribute-shortname

Content source URL

https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System.ComponentModel.DataAnnotations/DisplayAttribute.xml

Document Version Independent Id

e1258848-d7f7-52b7-7fcd-10af6741e913

Platform Id

c48099ec-c828-67a4-0987-e5bb23e93914

Article author

@dotnet-bot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions