I am trying to create a generic formatter/parser combination.
Example scenario:
var format = \"{0}-{1}\
After formatting, you can put the resulting string and the array of objects into a dictionary with the string as key:
Dictionary unFormatLookup = new Dictionary
...
var arr = new string [] {"asdf", "qwer" };
var res = string.Format(format, arr);
unFormatLookup.Add(res,arr);
and in Unformat method, you can simply pass a string and look up that string and return the array used:
string [] Unformat(string res)
{
string [] arr;
unFormatLoopup.TryGetValue(res,out arr); //you can also check the return value of TryGetValue and throw an exception if the input string is not in.
return arr;
}