File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,11 +38,7 @@ public TextLines()
3838 /// <param name="inputLines">An IEnumerable type that represent lines in a text.</param>
3939 public TextLines ( IEnumerable < string > inputLines ) : this ( )
4040 {
41- if ( inputLines == null )
42- {
43- throw new ArgumentNullException ( nameof ( inputLines ) ) ;
44- }
45-
41+ ThrowIfNull ( inputLines , nameof ( inputLines ) ) ;
4642 if ( inputLines . Any ( line => line == null ) )
4743 {
4844 // todo localize
@@ -161,6 +157,7 @@ public int IndexOf(string item)
161157 public void Insert ( int index , string item )
162158 {
163159 ValidateIndex ( index ) ;
160+ ThrowIfNull ( item , nameof ( item ) ) ;
164161 SetLastAccessed ( index , lines . AddBefore ( GetNodeAt ( index ) , item ) ) ;
165162 Count ++ ;
166163 }
@@ -323,5 +320,13 @@ private void GetClosestReference(
323320 searchDirection = 1 ;
324321 }
325322 }
323+
324+ private static void ThrowIfNull < T > ( T param , string paramName )
325+ {
326+ if ( param == null )
327+ {
328+ throw new ArgumentNullException ( paramName ) ;
329+ }
330+ }
326331 }
327332}
You can’t perform that action at this time.
0 commit comments