Sunday 15 July 2012

c# - Possible to pass format specifier for an argument as another argument to String.Format? -


For example, suppose I have a datetime format string in the string variable, there is no syntax or method in it. In the net, let me do this invalid code:

  string line = string.format ("{0: {1}}", date time., Now, datetime format); ^^^ ^ | | + - It will use - +  

I think dynamic parameter

You will have to use 2 phase system in any way, either by preferring your date or formatting string. But I think the problem will be worse than both.


No comments:

Post a Comment