forked from sarbian/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTagList.cs
More file actions
30 lines (25 loc) · 847 Bytes
/
Copy pathTagList.cs
File metadata and controls
30 lines (25 loc) · 847 Bytes
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
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ModuleManager.Collections;
namespace ModuleManager.Tags
{
public interface ITagList : IEnumerable<Tag>
{
Tag PrimaryTag { get; }
}
public class TagList : ITagList
{
private readonly Tag[] tags;
public TagList(Tag primaryTag, IEnumerable<Tag> tags)
{
PrimaryTag = primaryTag;
this.tags = tags?.ToArray() ?? throw new ArgumentNullException(nameof(tags));
}
public Tag PrimaryTag { get; private set; }
public ArrayEnumerator<Tag> GetEnumerator() => new ArrayEnumerator<Tag>(tags);
IEnumerator<Tag> IEnumerable<Tag>.GetEnumerator() => GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}