3 public static class Extensions
6 /// Get the array slice between the index (inclusive and end of array).
8 public static T
[] Slice
< T
>( this T
[] source
, int start
)
11 T
[] res
= new T
[source
.Length
- start
];
12 for ( int i
= 0; i
< source
.Length
- start
; ++i
)
14 res
[ i
] = source
[ i
+ start
];
20 /// Get the array slice between the two indexes.
21 /// Inclusive for start index, exclusive for end index.
23 public static T
[] Slice
< T
>( this T
[] source
, int start
, int end
)
25 // Handles negative ends
28 end
= source
.Length
- start
- end
- 1;
30 int len
= end
- start
;
34 for ( int i
= 0; i
< len
; ++i
)
36 res
[ i
] = source
[ i
+ start
];
42 /// Get count of arguments ocurances in this string.
44 /// <param name="string"></param>
45 /// <param name="char"></param>
46 /// <returns></returns>
47 public static int Count( this string @string, char @char )
53 index
= @string.IndexOf( @char, index
);