Created
April 11, 2018 02:13
-
-
Save copygirl/116750aa16d11b6e3a5d845cd5d4b31c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ThrowOrSetError(string message, params object[] args) | |
{ | |
if (throwException) throw new FormatException( | |
$"Error parsing version string '{ s }' at index { i }: " | |
+ string.Format(message, args.Select(element => { | |
// If a char? argument is passed, treat it in a special way. | |
while (true) { } | |
throw new Exception(element.GetType().ToString()); | |
if (element is char?) { | |
var chr = (char?)element; | |
return (chr != null) ? $"'{ chr }'" : "end of string"; | |
} else return element; | |
}).ToArray())); | |
else error = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment