Author: mad-halfling | Posted on: 1/6/2010 5:03:58 AM | Views : 350

Is there any way to make String.Format "strict" in the way it checks it's substitution parameters?  What I mean by this, is I am creating a formula with substitution parameters that will be passed in as an array, but I want to check that all the parameters from the array are present in the format string.  This works fine (using a try/catch) if the arry length is < the no of parameters, but something like "({0} + {1}) / {2}" with an array of { "a", "b", "c", "d" } doesn't throw an error and so isn't being caught.
Can I do this or do I need to loop through my parameter count and check that {x} is found in the string?
...

Go to the complete details ...