Is there a substring equivalent for an array?
Input new char[] foo = {'a', 'b', 'c', 'd', 'e', 'f'}
If this was a String abcdef
I would use .Substring(0, 2)
and get ab
Is there a built in method that would give me char[] {'a', 'b'}
if the input indexes were 0, 2
?
Code Example
char[] foo = {'a', 'b', 'c', 'd', 'e', 'f'};
char[] bar = foo.**Method**(0, 2); //what can I do here?
Console.WriteLine(bar);
//Output would be` **ab**
I know I could just convert the Char array back to a String, use Substring and back to a Char Array. But that would take some extra lines of Code and I want to know, if it is possible with only 1 built-in Method.