Clone a String in C#
In this article we will discuss about how to create clone a string in c#
The Clone method of string class is used to clone a string. The Clone method returns the reference of the same string. The following code snippet clones a string.
string firstName = "Mahesh";
string lastName = "Chand";
string authorName = firstName + " " + lastName ;
string cloneAuthor = authorName.Clone().ToString();
Console.WriteLine(authorName);
Console.WriteLine(cloneAuthor);
|
Got a programming related question? You may want to post your question here