C# String Clone() Method
C# String Clone()
The Clone()
method is used to clone the string object, which returns another copy of same data.
The return type of Clone()
method is object.
Note: This type of cloning is called shallow copy, i.e, any changes made to any string object will not affect the other.
Example
Output
Syntax
Parameter Value
This method does not take any parameter.
Return Value
Value | Explanation |
---|---|
Object | Returns a reference to this instance of String. |
More Example
In the following example, any changes made to Actual string (s1) will not affect the clone string (s2).
Example
Output
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.