What are strin concatation methods in c#?
Answer Posted / 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 View All Answers
How many bytes is a char c#?
What is the difference between constant and readonly in c#?
How to assign Null value to Var?
What is an extension method in c#?
How do you declare a variable in c#?
What are the benefits of using windows services:
What is difference between abstract class and interface in c#?
Can scriptable objects have methods?
What is the purpose of constructor in c#?
What is difference between float and integer?
Can you inherit multiple classes in c#?
Are c and c# the same thing?
What is multithreading? What are the problems that comes with multithreading and how to manage them?
How do you define a predicate?
What is default c#?