String questieon

Using this example:
http://www.programmersheaven.com/2/Les_CSharp_4_p3

How would I do this?

string string1 = ("{0} of {1} years age got {2}% marks", st1.name, st1.age, st1.percentage);
MessageBox.Show(string1);

ie, first assign the value to the string, then display it.
The first line isn't correct.
LVL 1
allelopathAsked:
Who is Participating?
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
string string1 = String.Format("{0} of {1} years age got {2}% marks", st1.name, st1.age, st1.percentage);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.