Plane.Sdk3/PlaneGcsSdk_Shared/TaskTools/Attributes/DisplayTextAttribute.cs

45 lines
1.1 KiB
C#
Raw Normal View History

2017-02-27 02:02:19 +08:00
#region Using Statements
using System;
#endregion
namespace TaskTools.Attributes
{
/// <summary>
/// Used to decorate a type or type member with display text.
/// </summary>
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
internal sealed class DisplayTextAttribute : Attribute
{
private readonly string _text;
/// <summary>
/// Initializes a new instance of the <see cref="DisplayTextAttribute"/> class.
/// </summary>
/// <param name="text">The text.</param>
/// <exception cref="ArgumentException">
/// Thrown when <paramref name="text"/> is null or empty.
/// </exception>
internal DisplayTextAttribute(string text)
{
if (String.IsNullOrEmpty(text))
{
throw new ArgumentException("\"text\" is required.");
}
_text = text;
}
/// <summary>
/// Gets the text.
/// </summary>
/// <value>The text.</value>
internal string Text
{
get { return _text; }
}
}
}