C# String Copy() Method

You are Here:

C# String Copy()

The Copy() method creates a new instance of String with the same content as a specified string.

Example

C# Compiler
using System; namespace myApp { class Program { static void Main(string[] args) { string s1 = "John doe"; string s2 = string.Copy(s1); Console.Write("s2 = {0}", s2); } } }

Output

s2 = John doe

Syntax

public static string.Copy(s1)

Parameter Values

ValueTypeExplanation
s1RequiredSpecifies the string to be copied.

Return Value

ValueExplanation
StringReturns a new String with the same content as a specified String.

Reminder

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