C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String Copy()The C# Copy() method is used to create a new instance of String with the same value as a specified String. It is a static method of String class. Its return type is string. Signaturepublic static string Copy(String str) Parameterstr: it takes a string argument which is used to create a copy of specified string. ReturnIt returns string object. C# String Copy() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = "Hello "; string s2 = string.Copy(s1); Console.WriteLine(s1); Console.WriteLine(s2); } } Output: Hello Hello
Next TopicC# String CopyTo()
|