Skip to content

Commit 098a929

Browse files
committed
fix: add enumerable ctor to liveList
1 parent d211b7d commit 098a929

File tree

1 file changed

+64
-56
lines changed

1 file changed

+64
-56
lines changed

src/Yaapii.Atoms/Lists/LiveList.cs

+64-56
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,71 @@
1-
// MIT License
2-
//
3-
// Copyright(c) 2021 ICARUS Consulting GmbH
4-
//
5-
// Permission is hereby granted, free of charge, to any person obtaining a copy
6-
// of this software and associated documentation files (the "Software"), to deal
7-
// in the Software without restriction, including without limitation the rights
8-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
// copies of the Software, and to permit persons to whom the Software is
10-
// furnished to do so, subject to the following conditions:
11-
//
12-
// The above copyright notice and this permission notice shall be included in all
13-
// copies or substantial portions of the Software.
14-
//
15-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
// SOFTWARE.
22-
23-
using System;
24-
using System.Collections.Generic;
1+
// MIT License
2+
//
3+
// Copyright(c) 2021 ICARUS Consulting GmbH
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in all
13+
// copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
// SOFTWARE.
22+
23+
using System;
24+
using System.Collections.Generic;
2525
using Yaapii.Atoms.Enumerable;
2626

27-
namespace Yaapii.Atoms.List
28-
{
29-
/// <summary>
30-
/// Makes a readonly list.
31-
/// </summary>
32-
/// <typeparam name="T">type of items</typeparam>
33-
public sealed class LiveList<T> : ListEnvelope<T>
34-
{
35-
/// <summary>
36-
/// Makes a readonly list.
37-
/// </summary>
38-
public LiveList(params T[] array) : this(() =>
39-
new List<T>(array)
27+
namespace Yaapii.Atoms.List
28+
{
29+
/// <summary>
30+
/// Makes a readonly list.
31+
/// </summary>
32+
/// <typeparam name="T">type of items</typeparam>
33+
public sealed class LiveList<T> : ListEnvelope<T>
34+
{
35+
/// <summary>
36+
/// Makes a readonly list.
37+
/// </summary>
38+
public LiveList(params T[] array) : this(() =>
39+
new List<T>(array)
4040
)
41-
{ }
42-
43-
/// <summary>
44-
/// Makes a readonly list.
45-
/// </summary>
46-
public LiveList(IEnumerator<T> src) : this(() =>
47-
new List<T>(
48-
new LiveMany<T>(() => src)
49-
)
41+
{ }
42+
43+
/// <summary>
44+
/// Makes a readonly list.
45+
/// </summary>
46+
public LiveList(IEnumerator<T> src) : this(() =>
47+
new List<T>(
48+
new LiveMany<T>(() => src)
49+
)
5050
)
5151
{ }
5252

53-
/// <summary>
54-
/// Makes a readonly list.
55-
/// </summary>
56-
/// <param name="src">source enumerable</param>
57-
public LiveList(Func<IList<T>> src) : base(
58-
src,
59-
true
60-
)
53+
/// <summary>
54+
/// Makes a readonly list.
55+
/// </summary>
56+
public LiveList(IEnumerable<T> src) : this(
57+
() => new List<T>(src)
58+
)
6159
{ }
62-
}
63-
}
60+
61+
/// <summary>
62+
/// Makes a readonly list.
63+
/// </summary>
64+
/// <param name="src">source enumerable</param>
65+
public LiveList(Func<IList<T>> src) : base(
66+
src,
67+
true
68+
)
69+
{ }
70+
}
71+
}

0 commit comments

Comments
 (0)