22
33namespace ValveKeyValue
44{
5+ /// <summary>
6+ /// Represents an array of KeyValue values.
7+ /// </summary>
58 public class KVArrayValue : KVValue , IEnumerable < KVValue > , ICollection < KVValue > , IList < KVValue >
69 {
10+ /// <summary>
11+ /// Initializes a new instance of the <see cref="KVArrayValue"/> class.
12+ /// </summary>
713 public KVArrayValue ( )
814 {
915 children = new List < KVValue > ( ) ;
1016 }
1117
1218 readonly List < KVValue > children ;
1319
20+ /// <inheritdoc/>
1421 public override KVValueType ValueType => KVValueType . Array ;
1522
23+ /// <inheritdoc/>
1624 public int Count => children . Count ;
1725
26+ /// <inheritdoc/>
1827 public bool IsReadOnly => false ;
1928
29+ /// <inheritdoc/>
2030 public override KVValue this [ string key ]
2131 {
2232 get { throw new NotSupportedException ( $ "The indexer on a { nameof ( KVArrayValue ) } can only be used on integer keys, not strings.") ; }
2333 }
2434
35+ /// <inheritdoc/>
2536 public KVValue this [ int key ]
2637 {
2738 get
@@ -34,12 +45,17 @@ public KVValue this[int key]
3445 }
3546 }
3647
48+ /// <inheritdoc/>
3749 public void Add ( KVValue value )
3850 {
3951 ArgumentNullException . ThrowIfNull ( value ) ;
4052 children . Add ( value ) ;
4153 }
4254
55+ /// <summary>
56+ /// Adds multiple values to the array.
57+ /// </summary>
58+ /// <param name="values">The values to add.</param>
4359 public void AddRange ( IEnumerable < KVValue > values )
4460 {
4561 ArgumentNullException . ThrowIfNull ( values ) ;
@@ -48,90 +64,108 @@ public void AddRange(IEnumerable<KVValue> values)
4864
4965 #region IEnumerable<KVValue>
5066
67+ /// <inheritdoc/>
5168 public IEnumerator < KVValue > GetEnumerator ( ) => children . GetEnumerator ( ) ;
5269
5370 #endregion
5471
5572 #region IConvertible
5673
74+ /// <inheritdoc/>
5775 public override TypeCode GetTypeCode ( )
5876 {
5977 throw new NotSupportedException ( ) ;
6078 }
6179
80+ /// <inheritdoc/>
6281 public override bool ToBoolean ( IFormatProvider provider )
6382 {
6483 throw new NotSupportedException ( ) ;
6584 }
6685
86+ /// <inheritdoc/>
6787 public override byte ToByte ( IFormatProvider provider )
6888 {
6989 throw new NotSupportedException ( ) ;
7090 }
7191
92+ /// <inheritdoc/>
7293 public override char ToChar ( IFormatProvider provider )
7394 {
7495 throw new NotSupportedException ( ) ;
7596 }
7697
98+ /// <inheritdoc/>
7799 public override DateTime ToDateTime ( IFormatProvider provider )
78100 {
79101 throw new NotSupportedException ( ) ;
80102 }
81103
104+ /// <inheritdoc/>
82105 public override decimal ToDecimal ( IFormatProvider provider )
83106 {
84107 throw new NotSupportedException ( ) ;
85108 }
86109
110+ /// <inheritdoc/>
87111 public override double ToDouble ( IFormatProvider provider )
88112 {
89113 throw new NotSupportedException ( ) ;
90114 }
91115
116+ /// <inheritdoc/>
92117 public override short ToInt16 ( IFormatProvider provider )
93118 {
94119 throw new NotSupportedException ( ) ;
95120 }
96121
122+ /// <inheritdoc/>
97123 public override int ToInt32 ( IFormatProvider provider )
98124 {
99125 throw new NotSupportedException ( ) ;
100126 }
101127
128+ /// <inheritdoc/>
102129 public override long ToInt64 ( IFormatProvider provider )
103130 {
104131 throw new NotSupportedException ( ) ;
105132 }
106133
134+ /// <inheritdoc/>
107135 public override sbyte ToSByte ( IFormatProvider provider )
108136 {
109137 throw new NotSupportedException ( ) ;
110138 }
111139
140+ /// <inheritdoc/>
112141 public override float ToSingle ( IFormatProvider provider )
113142 {
114143 throw new NotSupportedException ( ) ;
115144 }
116145
146+ /// <inheritdoc/>
117147 public override string ToString ( IFormatProvider provider )
118148 => ToString ( ) ;
119149
150+ /// <inheritdoc/>
120151 public override object ToType ( Type conversionType , IFormatProvider provider )
121152 {
122153 throw new NotSupportedException ( ) ;
123154 }
124155
156+ /// <inheritdoc/>
125157 public override ushort ToUInt16 ( IFormatProvider provider )
126158 {
127159 throw new NotSupportedException ( ) ;
128160 }
129161
162+ /// <inheritdoc/>
130163 public override uint ToUInt32 ( IFormatProvider provider )
131164 {
132165 throw new NotSupportedException ( ) ;
133166 }
134167
168+ /// <inheritdoc/>
135169 public override ulong ToUInt64 ( IFormatProvider provider )
136170 {
137171 throw new NotSupportedException ( ) ;
@@ -145,40 +179,48 @@ public override ulong ToUInt64(IFormatProvider provider)
145179
146180 #endregion
147181
182+ /// <inheritdoc/>
148183 public override string ToString ( ) => "[Array]" ;
149184
185+ /// <inheritdoc/>
150186 public void Clear ( ) => children . Clear ( ) ;
151187
188+ /// <inheritdoc/>
152189 public bool Contains ( KVValue item )
153190 {
154191 ArgumentNullException . ThrowIfNull ( item ) ;
155192 return children . Contains ( item ) ;
156193 }
157194
195+ /// <inheritdoc/>
158196 public void CopyTo ( KVValue [ ] array , int arrayIndex )
159197 {
160198 ArgumentNullException . ThrowIfNull ( array ) ;
161199 children . CopyTo ( array , arrayIndex ) ;
162200 }
163201
202+ /// <inheritdoc/>
164203 public bool Remove ( KVValue item )
165204 {
166205 ArgumentNullException . ThrowIfNull ( item ) ;
167206 return children . Remove ( item ) ;
168207 }
169208
209+ /// <inheritdoc/>
170210 public int IndexOf ( KVValue item )
171211 {
172212 ArgumentNullException . ThrowIfNull ( item ) ;
173213 return children . IndexOf ( item ) ;
174214 }
175215
216+ /// <inheritdoc/>
176217 public void Insert ( int index , KVValue item )
177218 {
178219 ArgumentNullException . ThrowIfNull ( item ) ;
179220 children . Insert ( index , item ) ;
180221 }
181222
223+ /// <inheritdoc/>
182224 public void RemoveAt ( int index ) => children . RemoveAt ( index ) ;
183225 }
184226}
0 commit comments