You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MaxLengthAttribute.cs 757 B

12345678910111213141516171819202122232425
  1. using System;
  2. namespace Discord.Interactions
  3. {
  4. /// <summary>
  5. /// Sets the maximum length allowed for a string type parameter.
  6. /// </summary>
  7. [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
  8. public class MaxLengthAttribute : Attribute
  9. {
  10. /// <summary>
  11. /// Gets the maximum length allowed for a string type parameter.
  12. /// </summary>
  13. public int Length { get; }
  14. /// <summary>
  15. /// Sets the maximum length allowed for a string type parameter.
  16. /// </summary>
  17. /// <param name="length">Maximum string length allowed.</param>
  18. public MaxLengthAttribute(int length)
  19. {
  20. Length = length;
  21. }
  22. }
  23. }