Comments in format strings?

  • Thread starter Thread starter Hugh Williams
  • Start date Start date
H

Hugh Williams

I've got some pretty huge format strings that get hard to maintain. I'd
like to place comments in the format item, kind of like this:

String.Format("My name is {0://first name goes here}.", firstName);

Is there any way to do this?
 
The only way I know of is:

// 0 = First Name
String.Format("My name is {0}.", firstName);

(Yea, I know, not much help). In other words, I don't think that's possible
currently.

-mike
MVP
 
Hi

Maybe this might help you, if you set your code out like this:

String.Format("My name is {0} {1} {2}.",
FirstName, //0
MiddleName, //1
Surname //2
);
 
Back
Top