C# String Clone() Method Last Updated : 13 Mar, 2025 Comments Improve Suggest changes Like Article Like Report In C#, the Clone() method is a String method. It is used to clone the string object, which returns another copy of that data. In other words, it returns a reference to this instance of String. The return value will be only another view of the same data. The Clone() method is called directly on the current String instance. This method will not take any parameters. Some important characteristics of the clone method are,This method is part of the ICloneable interface.Strings are immutable, so we cannot change their values that's why we need to use the Clone() method.The clone() method created a Shallow copy of the object ( They refer to the same memory).Strings are immutable, so the Clone() method creates a new identical string object with the same reference.Example 1: Demonstration of String Clone() method. csharp // C# program to illustrate // Clone() method using System; class Geeks { public static void Main(string[] args) { string s = "GeeksforGeeks"; // Cannot implicitly convert // type object to the string. // So explicit conversion // using Clone() method string clone = (String)s.Clone(); // Displaying both the string Console.WriteLine("Original String : {0}", s); Console.WriteLine("Clone String : {0}", clone); } } OutputOriginal String : GeeksforGeeks Clone String : GeeksforGeeks Syntax of String Clone() Methodpublic object Clone()Return Type: This method returns a reference of an original string of type System.Object.Example 2: Demonstration of how the object created by the Clone() method shares the same reference (shallow copy). C# using System; class Geeks { public static void Main() { string s = "Hello, World!"; string s2 = "Hello, World!"; // using the string clone method string Clone = (string)s.Clone(); Console.WriteLine("Is s and s2 sharing the same memory location: {0}", object.ReferenceEquals(s, s2)); Console.WriteLine("Is s and Clone sharing the same memory location: {0}", object.ReferenceEquals(s, Clone)); } } Explanation: In the above example, we use the Clone() method to clone a string object. And check their memory reference. We know that the strings are immutable in C# so if we create another string with the same value it also shares the same reference but if we modify the Clone object it will not affect the original object because it will create a new string instance in that case.Important Points:The String.Clone() method creates a shallow copy of a string object but due to its Immutaballity. If we make any modification to the clone object does not reflect on the original objectIt behaves like a deep copy but internally it is shallow copy the difference between deep and shallow copy covered in this article. Comment More infoAdvertise with us Next Article C# String Clone() Method M Mithun Kumar Follow Improve Article Tags : C# CSharp-method CSharp-string Similar Reads C# String CopyTo() Method In C#, the CopyTo() is a method of String Class. It is used to copy a specified number of characters from a specified position in the string and it copies the characters of this string into an array of Unicode characters.Example 1: Using the CopyTo() method to copy characters from a string to a char 2 min read StringBuilder.CopyTo Method in C# This method is used to copy the characters from a specified segment of this instance to a specified segment of a destination Char array. Syntax: public void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count); Parameters: sourceIndex: It is the starting position in this ins 2 min read C# | CharEnumerator.ToString() Method CharEnumerator.ToString() Method is used to get a string that represents the current object. It is inherited from the Object Class. Syntax: public virtual string ToString(); Return Value: This method returns a string which represents the current CharEnumerator object. Below are the programs to illus 2 min read C# | Copy() Method In C#, Copy() is a string method. It is used to create a new instance of String with the same value for a specified String. The Copy() method returns a String object, which is the same as the original string but represents a different object reference. To check its reference, use assignment operatio 2 min read C# | CharEnumerator.Clone() Method CharEnumerator.Clone Method is used to create a copy of the current CharEnumerator object. This is useful for saving the current state while iterating through a String object. Syntax: public object Clone (); Return Value: This method returns an Object which is a copy of the current CharEnumerator ob 2 min read Like