-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPublicSuffixList.cs
43 lines (27 loc) · 987 Bytes
/
PublicSuffixList.cs
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
40
41
42
43
using System;
using System.Collections;
using System.Collections.Generic;
namespace Gsemac.Net {
internal sealed class PublicSuffixList :
IPublicSuffixList {
// Public members
public PublicSuffixList(IEnumerable<string> suffixList) {
if (suffixList is null)
throw new ArgumentNullException(nameof(suffixList));
suffixLookup = new HashSet<string>(suffixList, StringComparer.OrdinalIgnoreCase);
}
public bool Contains(string suffix) {
if (string.IsNullOrWhiteSpace(suffix))
return false;
return suffixLookup.Contains(suffix);
}
public IEnumerator<string> GetEnumerator() {
return suffixLookup.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return suffixLookup.GetEnumerator();
}
// Private members
private readonly HashSet<string> suffixLookup;
}
}