Click here to Skip to main content
15,905,148 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have
one
two
three
but i want one or two or three how its make?
in c#
Posted
Comments
Prasad Khandekar 16-Apr-13 6:36am    
You already have one two and three? so you can have one or two or three? Where is the problem?
sainadh.chintha 16-Apr-13 6:56am    
explain in detail. what i am understand is you want to Concatenate the strings.
string two = "two";
string str = "one " + two + " three";
System.Console.WriteLine(str);

Try:
C#
string s1 = "One";
string s2 = "Two";
string s3 = "Three";
string combined = string.Format("{0} or {1} or {2}", s1, s2, s3);
Or
C#
string s1 = "One";
string s2 = "Two";
string s3 = "Three";
string combined = s1 + " or " + s2 + " or " + s3;
But this is not good practice.
 
Share this answer
 
Comments
CPallini 16-Apr-13 7:10am    
Have my 5 for spreading bad practices. :-)
C#
string two = "two";
string str = "one " + two + " three";
System.Console.WriteLine(str);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900