aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/IHasTaglines.cs
blob: 8025d6b4407510a47812afcc724b54ca49ec3bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;

namespace MediaBrowser.Controller.Entities
{
    /// <summary>
    /// Interface IHasTaglines
    /// </summary>
    public interface IHasTaglines
    {
        /// <summary>
        /// Gets or sets the taglines.
        /// </summary>
        /// <value>The taglines.</value>
        List<string> Taglines { get; set; }
    }

    public static class TaglineExtensions
    {
        /// <summary>
        /// Adds the tagline.
        /// </summary>
        /// <param name="tagline">The tagline.</param>
        /// <exception cref="System.ArgumentNullException">tagline</exception>
        public static void AddTagline(this IHasTaglines item, string tagline)
        {
            if (string.IsNullOrWhiteSpace(tagline))
            {
                throw new ArgumentNullException("tagline");
            }

            if (!item.Taglines.Contains(tagline, StringComparer.OrdinalIgnoreCase))
            {
                item.Taglines.Add(tagline);
            }
        }
    }
}