diff --git a/src/Meziantou.Analyzer.Annotations/CultureInsensitiveTypeAttribute.cs b/src/Meziantou.Analyzer.Annotations/CultureInsensitiveTypeAttribute.cs index 513c5525..f103b886 100644 --- a/src/Meziantou.Analyzer.Annotations/CultureInsensitiveTypeAttribute.cs +++ b/src/Meziantou.Analyzer.Annotations/CultureInsensitiveTypeAttribute.cs @@ -10,16 +10,84 @@ namespace Meziantou.Analyzer.Annotations; [System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Struct | System.AttributeTargets.Class, AllowMultiple = true, Inherited = false)] public sealed class CultureInsensitiveTypeAttribute : System.Attribute { + /// + /// Initializes a new instance of the class. + /// + /// + /// This can be applied on a given type to mark all its formats as culture insensitive. + /// public CultureInsensitiveTypeAttribute() { } + /// + /// Initializes a new instance of the class with the specified format. + /// + /// + /// This can be applied on a given type to mark the specified format as culture insensitive for that type. + /// public CultureInsensitiveTypeAttribute(string? format) => Format = format; + + /// + /// Initializes a new instance of the class. + /// + /// When , marks the default format (i.e., the ToString() method) of the type on which it is applied as culture insensitive. + /// + /// This can be applied on a given type to mark the default format (i.e., the ToString() method) as culture insensitive. + /// public CultureInsensitiveTypeAttribute(bool isDefaultFormatCultureInsensitive) => IsDefaultFormatCultureInsensitive = isDefaultFormatCultureInsensitive; + + /// + /// Initializes a new instance of the class with the specified . + /// + /// The for which to mark all formats as culture insensitive + /// + /// This can be applied on an to mark all formats of the specified as culture insensitive. + /// public CultureInsensitiveTypeAttribute(System.Type type) => Type = type; + + /// + /// Initializes a new instance of the class with the specified and format. + /// + /// The for which to mark the specified format as culture insensitive + /// The format to mark as culture insensitive + /// + /// This can be applied on an to mark the format of the specified as culture insensitive. + /// public CultureInsensitiveTypeAttribute(System.Type type, string? format) => (Type, Format) = (type, format); + + /// + /// Initializes a new instance of the class. + /// + /// The for which to mark the ToString() method as culture insensitive + /// When , marks the default format (i.e., the ToString() method) of as culture insensitive. + /// + /// This can be applied on an to mark the default format (i.e., the ToString() method) of as culture insensitive. + /// public CultureInsensitiveTypeAttribute(System.Type type, bool isDefaultFormatCultureInsensitive) => (Type, IsDefaultFormatCultureInsensitive) = (type, isDefaultFormatCultureInsensitive); + /// + /// Gets the for which to change the culture insensitivity. + /// + /// + /// The for which to change the culture insensitivity, or to change the culture insensitivity of + /// the type on which the attribute is applied. + /// public Type? Type { get; } + + /// + /// Gets the format for which to change the culture insensitivity. + /// + /// + /// The format for which to change the culture insensitivity. + /// public string? Format { get; } + + /// + /// Gets a value indicating whether the default format (i.e., the ToString() method) is culture insensitive. + /// + /// + /// to mark the default format (i.e., the ToString() method) as culture insensitive; + /// otherwise, . + /// public bool IsDefaultFormatCultureInsensitive { get; } }