Description
The Value
property of the TitleAttribute
class is a string
that represents the title or a "nice name" associated with a type or a type member. This property is used to provide a human-readable name that can be utilized by the DisplayInfo library to present information in a more user-friendly manner.
Usage
To use the Value
property, you must first apply the TitleAttribute
to a class, method, or property. The Value
property can then be set to a string that represents the desired title or name. This is particularly useful for UI elements or documentation where a more descriptive name is beneficial.
Example
// Example of using TitleAttribute with the Value property
[Title("Player Character")]
public class Player
{
// Class implementation
}
// Retrieving the title value
var titleAttribute = (TitleAttribute)Attribute.GetCustomAttribute(typeof(Player), typeof(TitleAttribute));
string title = titleAttribute?.Value;
// title should be "Player Character"