C# String CopyTo() Method

You are Here:

C# String CopyTo()

The CopyTo() method copies a specified number of characters from the specified position in the string to a specified position in an array of characters.


C# Compiler
using System; namespace myApp { class Program { static void Main(string[] args) { string s1 = "John doe"; char[] ch = new char[15]; s1.CopyTo(1, ch, 0, 7); Console.Write(ch); } } }


ohn doe


public void s1.CopyTo(int index, char[] ch, int start, int end)

Parameter Values

indexRequiredSpecifies the starting position of the source String to be copied.
chRequiredSpecifies the character array.
startRequiredSpecifies the start index of the character array.
endRequiredSpecifies the end index of the character array.

Return Value

-Returns nothing.


Hi Developers, we almost covered 90% of String functions and Interview Question on C# with examples for quick and easy learning.

We are working to cover every Single Concept in C#.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author