Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

c# newbie: combining two sting vars

Status
Not open for further replies.

skotman

ISP
Sep 11, 2003
328
US
Ok, I can do this in ASP with my eyes closed but I decided to tackle c# anyway.
I just started to be nice please :), I just want to combine two strings together to get one (or display two on one line)
in ASP the code would look like:

Dim fName
Dim lName
fName = "firstname"
lName = "lastname"
Response.Write("Your name is: " & fName & "space" & lName)

In c# I've got:
string fName;
string lName;
fName = "firstname";
lName = "lastname";
Console.WriteLine("Your name is: {0}", fName " {0}", lName)'


What am I doing wrong? And why the the heck are those {0} for? My code wont run with out them.
Thank you in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top