DocSpace-buildtools/common/ASC.Textile/FormatterStateAttribute.cs

21 lines
568 B
C#
Raw Normal View History

2022-02-17 09:08:01 +00:00
namespace Textile;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class FormatterStateAttribute : Attribute
2019-08-19 12:35:39 +00:00
{
2022-02-17 09:08:01 +00:00
public string Pattern { get; }
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
public FormatterStateAttribute(string pattern)
{
Pattern = pattern;
}
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
public static FormatterStateAttribute Get(Type type)
{
var atts = type.GetCustomAttributes(typeof(FormatterStateAttribute), false);
if (atts.Length == 0)
return null;
return (FormatterStateAttribute)atts[0];
2019-08-19 12:35:39 +00:00
}
}