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 ?
Discussion:
14 comments Page 2 of 2.
Amit Gupta said:
1 decade ago
Why not first is right?
Neeraj said:
1 decade ago
Mark is right. Because in s2=s1 giving the reference of s1 to s2.
Vishnu said:
1 decade ago
String s1 = "String";
String s2;
s2 = s1;
//it is also right
String s2;
s2 = s1;
//it is also right
Mark said:
1 decade ago
String s1 = "String";
String s2;
s2 = String.Copy(s1);
//is the right answer!!
String s2;
s2 = String.Copy(s1);
//is the right answer!!
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers