Re: string.Format and curly braces

2011-02-03 Thread Noon Silk
On Fri, Feb 4, 2011 at 12:02 PM, David Kean david.k...@microsoft.com wrote: I’m really interested in the scenario where you are passing user input as the format string – do you have user input with placeholders ({0}) that you need to fill? His problem is double formatting. Something like:

string.Format and curly braces

2011-02-02 Thread Greg Keogh
Back to coding ... I diagnosed an app crash today caused by an argument to string.Format having curly braces inside it. I was doing something like string.Format(Report title: {0}, title) where title was the string {Intention} and I'm told this is a perfectly acceptable title. We all know

Re: string.Format and curly braces

2011-02-02 Thread Grant Maw
Does this help? http://geekswithblogs.net/jonasb/archive/2007/03/05/108023.aspx On 3 February 2011 15:42, Greg Keogh g...@mira.net wrote: Back to coding ... I diagnosed an app crash today caused by an argument to string.Format having curly braces inside it. I was doing something like

RE: string.Format and curly braces

2011-02-02 Thread David Kean
Keogh Sent: Wednesday, February 02, 2011 9:42 PM To: 'ozDotNet' Subject: string.Format and curly braces Back to coding ... I diagnosed an app crash today caused by an argument to string.Format having curly braces inside it. I was doing something like string.Format(Report title: {0}, title) where

RE: string.Format and curly braces

2011-02-02 Thread Greg Keogh
You don't have to escape arguments, for example, below shouldn't crash on any version of .NET . We you perhaps instead passing user input as the format string instead? That you will have to escape. Oops! Sorry, you're right, I had it backwards. The format string contains {Intention} not the