Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NotifyCollectionChangedEventArgs.cs
Go to the documentation of this file.
2
4{
6
7 private readonly IList _newItems;
8
9 private readonly IList _oldItems;
10
11 private readonly int _newStartingIndex = -1;
12
13 private readonly int _oldStartingIndex = -1;
14
16
18
20
22
24
33
35 : this(action, changedItem, -1)
36 {
37 }
38
40 {
41 switch (action)
42 {
44 if (changedItem != null)
45 {
47 }
48 if (index != -1)
49 {
51 }
52 break;
54 _newItems = new SingleItemReadOnlyList(changedItem);
56 break;
58 _oldItems = new SingleItemReadOnlyList(changedItem);
60 break;
61 default:
63 }
65 }
66
68 : this(action, changedItems, -1)
69 {
70 }
71
73 {
74 switch (action)
75 {
77 if (changedItems != null)
78 {
80 }
81 if (startingIndex != -1)
82 {
84 }
85 break;
88 if (changedItems == null)
89 {
90 throw new ArgumentNullException("changedItems");
91 }
92 if (startingIndex < -1)
93 {
94 throw new ArgumentException(System.SR.IndexCannotBeNegative, "startingIndex");
95 }
97 {
98 _newItems = new ReadOnlyList(changedItems);
99 _newStartingIndex = startingIndex;
100 }
101 else
102 {
103 _oldItems = new ReadOnlyList(changedItems);
104 _oldStartingIndex = startingIndex;
105 }
106 break;
107 default:
109 }
110 _action = action;
111 }
112
114 : this(action, newItem, oldItem, -1)
115 {
116 }
117
118 public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? newItem, object? oldItem, int index)
119 {
121 {
123 }
124 _action = action;
125 _newItems = new SingleItemReadOnlyList(newItem);
126 _oldItems = new SingleItemReadOnlyList(oldItem);
128 }
129
131 : this(action, newItems, oldItems, -1)
132 {
133 }
134
136 {
138 {
140 }
141 if (newItems == null)
142 {
143 throw new ArgumentNullException("newItems");
144 }
145 if (oldItems == null)
146 {
147 throw new ArgumentNullException("oldItems");
148 }
149 _action = action;
150 _newItems = new ReadOnlyList(newItems);
151 _oldItems = new ReadOnlyList(oldItems);
152 _newStartingIndex = (_oldStartingIndex = startingIndex);
153 }
154
155 public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? changedItem, int index, int oldIndex)
156 {
158 {
160 }
161 if (index < 0)
162 {
164 }
165 _action = action;
166 _newItems = (_oldItems = new SingleItemReadOnlyList(changedItem));
168 _oldStartingIndex = oldIndex;
169 }
170
172 {
174 {
176 }
177 if (index < 0)
178 {
180 }
181 _action = action;
182 _newItems = (_oldItems = ((changedItems != null) ? new ReadOnlyList(changedItems) : null));
184 _oldStartingIndex = oldIndex;
185 }
186}
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList newItems, IList oldItems)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList? changedItems, int startingIndex)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? changedItem, int index, int oldIndex)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? changedItem)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? newItem, object? oldItem, int index)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList? changedItems, int index, int oldIndex)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList newItems, IList oldItems, int startingIndex)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? newItem, object? oldItem)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList? changedItems)
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object? changedItem, int index)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string MustBeResetAddOrRemoveActionForCtor
Definition SR.cs:34
static string IndexCannotBeNegative
Definition SR.cs:26
static string ResetActionRequiresIndexMinus1
Definition SR.cs:38
static string ResetActionRequiresNullItem
Definition SR.cs:36
static string WrongActionForCtor
Definition SR.cs:32
Definition SR.cs:7