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 a constructor? What is a destructor?

0 Answers  


What is difference between c and c sharp?

0 Answers  


Explain the accessibility modifier protected internal?

0 Answers  


What are the 3 logical operators?

0 Answers  


What is an object pool in .net?

0 Answers  






syntax for writing private method in a interface

7 Answers   ABMPL, Wipro,


What is ilist c#?

0 Answers  


If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?

2 Answers  


What is the root element of an xml file?

0 Answers  


What is the difference between array and arraylist c#?

0 Answers  


When a switch is said to be congested?

0 Answers   Wipro,


Write a syntax for writing a event delegate.

0 Answers  


Categories