-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Layout.Impl.cs
76 lines (64 loc) · 1.4 KB
/
Layout.Impl.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.Maui.Controls
{
public abstract partial class Layout<T>
{
int ICollection<IView>.Count => _children.Count;
bool ICollection<IView>.IsReadOnly => ((ICollection<IView>) _children).IsReadOnly;
public IView this[int index] { get => _children[index]; set => _children[index] = (T)value; }
void ICollection<IView>.Add(IView child)
{
if (child is T view)
{
_children.Add(view);
}
}
bool ICollection<IView>.Remove(IView child)
{
if (child is T view)
{
_children.Remove(view);
return true;
}
return false;
}
int IList<IView>.IndexOf(IView child)
{
return _children.IndexOf(child);
}
void IList<IView>.Insert(int index, IView child)
{
if (child is T view)
{
_children.Insert(index, view);
}
}
void IList<IView>.RemoveAt(int index)
{
_children.RemoveAt(index);
}
void ICollection<IView>.Clear()
{
_children.Clear();
}
bool ICollection<IView>.Contains(IView child)
{
return _children.Contains(child);
}
void ICollection<IView>.CopyTo(IView[] array, int arrayIndex)
{
_children.CopyTo(array, arrayIndex);
}
IEnumerator<IView> IEnumerable<IView>.GetEnumerator()
{
return _children.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _children.GetEnumerator();
}
}
}