diff options
| author | hatharry <hatharry@hotmail.com> | 2016-07-25 23:29:52 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-25 23:29:52 +1200 |
| commit | f21f9923de6291aaf985f32dbbbaddbb26d07fb1 (patch) | |
| tree | 1a313e9a1c6790a755926bcef221c5f680537eae /MediaBrowser.Controller/Entities/TagExtensions.cs | |
| parent | 6332d0b9436c511a59e2abd67ea8c24ce3d82ace (diff) | |
| parent | 8328f39834f042e1808fd8506bbc7c48151703ab (diff) | |
Merge pull request #15 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Controller/Entities/TagExtensions.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/TagExtensions.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/TagExtensions.cs b/MediaBrowser.Controller/Entities/TagExtensions.cs new file mode 100644 index 000000000..0e1df72cd --- /dev/null +++ b/MediaBrowser.Controller/Entities/TagExtensions.cs @@ -0,0 +1,21 @@ +using System; +using System.Linq; + +namespace MediaBrowser.Controller.Entities +{ + public static class TagExtensions + { + public static void AddTag(this BaseItem item, string name) + { + if (string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentNullException("name"); + } + + if (!item.Tags.Contains(name, StringComparer.OrdinalIgnoreCase)) + { + item.Tags.Add(name); + } + } + } +} |
