c# create an arbitrary length generic parameter string e.g. ?,?,?
- by Sky Sanders
I know I am forgetting to remember how to do this and it is late.
I want to, in an elegant manner, build a placeholder list for a munged sql command.
Have a command with an arbitrary number of parameters, need to build ?,?,?
Did I mention that it was a wet brain fart? this is what came out:
Regex.Replace(new string('?', _command.Parameters.Count), @"\?\?", @"\?,\?");
You are welcome to make me feel like more of an idiot if you just remember me what I am forgetting. ;-)