Given a string and we have to copy number of character from given position to character array in C#.Net.
To copy specified number characters of string to character array .NET framework provides built in method, which is:
string.CopyTo(int sourceIndex, char []destArray, int destIndex , int totalChar);
Here,
sourceIndex : It is the index of string from which we are copying characters to character array.
destArray : It is a character array, in which we are copying characters form string.
destIndex : It is index of destination character array.
totalChar : It specifies, how many characters will we copied.
Consider the program:
Output