C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 3)
3.
Which of the following statements will correctly copy the contents of one string into another ?
String s1 = "String";
String s2; 
s2 = s1;
String s1 = "String" ; 
String s2;
s2 = String.Concat(s1, s2);
String s1 = "String"; 
String s2;
s2 = String.Copy(s1);
String s1 = "String"; 
String s2;
s2 = s1.Replace();
String s1 = "String"; 
String s2;
s2 = s2.StringCopy(s1);
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 2 of 2.

Neeraj said:   1 decade ago
Mark is right. Because in s2=s1 giving the reference of s1 to s2.

Mahi said:   1 decade ago
Can't find the difference.

Can anyone tell clearly.

Dheer said:   1 decade ago
String s2, s1 = "string";

s2 = s1;
s2.equals(s1);

Amit Gupta said:   1 decade ago
Why not first is right?


Post your comments here:

Your comments will be displayed after verification.