What are strin concatation methods in c#?



What are strin concatation methods in c#?..

Answer / kishoreg

Generally in c# strings were concatinated with symbol '+'
1)'+'
string myName;
myName='GVK' + 'kishore';
2)Append
If it is StringBuilder then we can join as below
StringBuilderObject.Append('GVK');
StringBuilderObject.Append('kishore');
3)Join
Join takes a String array and a separator string and
produces a single string with one separator between each
element in the array.Split does the opposite, splitting a
string made up of several elements separated by a
separator.
Ex. string commatext = "alpha,bravo,charlie";
string[] words = commatext.Split(',');
string dashed = string.Join("---", words);
MessageBox.Show(dashed);

Hope helpfull...KishoreG

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More C Sharp Interview Questions

what is used ref keyword in c#,and how we used it?

2 Answers  


How can I get around scope problems in a try/catch?

0 Answers  


What is the difference between string and string in c#?

0 Answers  


What is different about switch statements in c#?

0 Answers  


i want o/p 011242110 in c# code.

0 Answers   TCS,


Explain about WSDL

0 Answers   Digital GlobalSoft,


What are static and dynamic variables?

0 Answers   CGI,


Why c# is called type safe language?

0 Answers  


What is the difference while using directive vs using statement ?

0 Answers  


Where is the keyword void used?

0 Answers  


What is the difference between package and interface?

0 Answers   Hexaware,


What is int16?

0 Answers  


Categories