IHasTaglines.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace MediaBrowser.Controller.Entities
  5. {
  6. /// <summary>
  7. /// Interface IHasTaglines
  8. /// </summary>
  9. public interface IHasTaglines
  10. {
  11. /// <summary>
  12. /// Gets or sets the taglines.
  13. /// </summary>
  14. /// <value>The taglines.</value>
  15. List<string> Taglines { get; set; }
  16. }
  17. public static class TaglineExtensions
  18. {
  19. /// <summary>
  20. /// Adds the tagline.
  21. /// </summary>
  22. /// <param name="tagline">The tagline.</param>
  23. /// <exception cref="System.ArgumentNullException">tagline</exception>
  24. public static void AddTagline(this IHasTaglines item, string tagline)
  25. {
  26. if (string.IsNullOrWhiteSpace(tagline))
  27. {
  28. throw new ArgumentNullException("tagline");
  29. }
  30. if (!item.Taglines.Contains(tagline, StringComparer.OrdinalIgnoreCase))
  31. {
  32. item.Taglines.Add(tagline);
  33. }
  34. }
  35. }
  36. }