@@ -179,13 +179,13 @@ public int IndexOf(T item, int startIndex, int count, IEqualityComparer<T>? equa
179179 equalityComparer ??= EqualityComparer < T > . Default ;
180180 if ( equalityComparer == EqualityComparer < T > . Default )
181181 {
182- return Array . IndexOf ( self . array ! , item , startIndex , count ) ;
182+ return Array . IndexOf ( self . array , item , startIndex , count ) ;
183183 }
184184 else
185185 {
186186 for ( int i = startIndex ; i < startIndex + count ; i ++ )
187187 {
188- if ( equalityComparer . Equals ( self . array ! [ i ] , item ) )
188+ if ( equalityComparer . Equals ( self . array [ i ] , item ) )
189189 {
190190 return i ;
191191 }
@@ -264,13 +264,13 @@ public int LastIndexOf(T item, int startIndex, int count, IEqualityComparer<T>?
264264 equalityComparer ??= EqualityComparer < T > . Default ;
265265 if ( equalityComparer == EqualityComparer < T > . Default )
266266 {
267- return Array . LastIndexOf ( self . array ! , item , startIndex , count ) ;
267+ return Array . LastIndexOf ( self . array , item , startIndex , count ) ;
268268 }
269269 else
270270 {
271271 for ( int i = startIndex ; i >= startIndex - count + 1 ; i -- )
272272 {
273- if ( equalityComparer . Equals ( item , self . array ! [ i ] ) )
273+ if ( equalityComparer . Equals ( item , self . array [ i ] ) )
274274 {
275275 return i ;
276276 }
@@ -326,11 +326,11 @@ public ImmutableArray<T> Insert(int index, T item)
326326
327327 if ( index != 0 )
328328 {
329- Array . Copy ( self . array ! , tmp , index ) ;
329+ Array . Copy ( self . array , tmp , index ) ;
330330 }
331331 if ( index != self . Length )
332332 {
333- Array . Copy ( self . array ! , index , tmp , index + 1 , self . Length - index ) ;
333+ Array . Copy ( self . array , index , tmp , index + 1 , self . Length - index ) ;
334334 }
335335
336336 return new ImmutableArray < T > ( tmp ) ;
@@ -364,11 +364,11 @@ public ImmutableArray<T> InsertRange(int index, IEnumerable<T> items)
364364
365365 if ( index != 0 )
366366 {
367- Array . Copy ( self . array ! , tmp , index ) ;
367+ Array . Copy ( self . array , tmp , index ) ;
368368 }
369369 if ( index != self . Length )
370370 {
371- Array . Copy ( self . array ! , index , tmp , index + count , self . Length - index ) ;
371+ Array . Copy ( self . array , index , tmp , index + count , self . Length - index ) ;
372372 }
373373
374374 // We want to copy over the items we need to insert.
@@ -464,7 +464,7 @@ public ImmutableArray<T> AddRange(T[] items, int length)
464464 }
465465
466466 T [ ] tmp = new T [ self . Length + length ] ;
467- Array . Copy ( self . array ! , tmp , self . Length ) ;
467+ Array . Copy ( self . array , tmp , self . Length ) ;
468468 Array . Copy ( items , 0 , tmp , self . Length , length ) ;
469469
470470 return new ImmutableArray < T > ( tmp ) ;
@@ -488,7 +488,7 @@ public ImmutableArray<T> AddRange<TDerived>(TDerived[] items) where TDerived : T
488488 }
489489
490490 T [ ] tmp = new T [ self . Length + items . Length ] ;
491- Array . Copy ( self . array ! , tmp , self . Length ) ;
491+ Array . Copy ( self . array , tmp , self . Length ) ;
492492 Array . Copy ( items , 0 , tmp , self . Length , items . Length ) ;
493493
494494 return new ImmutableArray < T > ( tmp ) ;
@@ -558,7 +558,7 @@ public ImmutableArray<T> SetItem(int index, T item)
558558 Requires . Range ( index >= 0 && index < self . Length , nameof ( index ) ) ;
559559
560560 T [ ] tmp = new T [ self . Length ] ;
561- Array . Copy ( self . array ! , tmp , self . Length ) ;
561+ Array . Copy ( self . array , tmp , self . Length ) ;
562562 tmp [ index ] = item ;
563563 return new ImmutableArray < T > ( tmp ) ;
564564 }
@@ -658,8 +658,8 @@ public ImmutableArray<T> RemoveRange(int index, int length)
658658 }
659659
660660 T [ ] tmp = new T [ self . Length - length ] ;
661- Array . Copy ( self . array ! , tmp , index ) ;
662- Array . Copy ( self . array ! , index + length , tmp , index , self . Length - index - length ) ;
661+ Array . Copy ( self . array , tmp , index ) ;
662+ Array . Copy ( self . array , index + length , tmp , index , self . Length - index - length ) ;
663663 return new ImmutableArray < T > ( tmp ) ;
664664 }
665665
@@ -757,7 +757,7 @@ public ImmutableArray<T> RemoveAll(Predicate<T> match)
757757 }
758758
759759 List < int > ? removeIndices = null ;
760- for ( int i = 0 ; i < self . array ! . Length ; i ++ )
760+ for ( int i = 0 ; i < self . array . Length ; i ++ )
761761 {
762762 if ( match ( self . array [ i ] ) )
763763 {
@@ -838,7 +838,7 @@ public ImmutableArray<T> Sort(int index, int count, IComparer<T>? comparer)
838838 bool outOfOrder = false ;
839839 for ( int i = index + 1 ; i < index + count ; i ++ )
840840 {
841- if ( comparer . Compare ( self . array ! [ i - 1 ] , self . array [ i ] ) > 0 )
841+ if ( comparer . Compare ( self . array [ i - 1 ] , self . array [ i ] ) > 0 )
842842 {
843843 outOfOrder = true ;
844844 break ;
@@ -848,7 +848,7 @@ public ImmutableArray<T> Sort(int index, int count, IComparer<T>? comparer)
848848 if ( outOfOrder )
849849 {
850850 var tmp = new T [ self . Length ] ;
851- Array . Copy ( self . array ! , tmp , self . Length ) ;
851+ Array . Copy ( self . array , tmp , self . Length ) ;
852852 Array . Sort ( tmp , index , count , comparer ) ;
853853 return new ImmutableArray < T > ( tmp ) ;
854854 }
@@ -1372,7 +1372,7 @@ void ICollection.CopyTo(Array array, int index)
13721372 {
13731373 ImmutableArray < T > self = this ;
13741374 self . ThrowInvalidOperationIfNotInitialized ( ) ;
1375- Array . Copy ( self . array ! , 0 , array , index , self . Length ) ;
1375+ Array . Copy ( self . array , 0 , array , index , self . Length ) ;
13761376 }
13771377
13781378 /// <summary>
@@ -1494,13 +1494,13 @@ private ImmutableArray<T> RemoveAtRange(ICollection<int> indicesToRemove)
14941494 {
14951495 int copyLength = lastIndexRemoved == - 1 ? indexToRemove : ( indexToRemove - lastIndexRemoved - 1 ) ;
14961496 Debug . Assert ( indexToRemove > lastIndexRemoved ) ; // We require that the input be a sorted set.
1497- Array . Copy ( self . array ! , copied + removed , newArray , copied , copyLength ) ;
1497+ Array . Copy ( self . array , copied + removed , newArray , copied , copyLength ) ;
14981498 removed ++ ;
14991499 copied += copyLength ;
15001500 lastIndexRemoved = indexToRemove ;
15011501 }
15021502
1503- Array . Copy ( self . array ! , copied + removed , newArray , copied , self . Length - ( copied + removed ) ) ;
1503+ Array . Copy ( self . array , copied + removed , newArray , copied , self . Length - ( copied + removed ) ) ;
15041504
15051505 return new ImmutableArray < T > ( newArray ) ;
15061506 }
0 commit comments