static string AmazingSPrintf(string format, params VariableArgument[] args) { if (!args.Any()) return format; using (var combinedVariables = new CombinedVariables(args)) { var bufferCapacity = _vscprintf(format, combinedVariables.GetPtr()); var stringBuilder = new StringBuilder(bufferCapacity + 1); vsprintf(stringBuilder, format, combinedVariables.GetPtr()); return stringBuilder.ToString(); } }
static string AmazingSPrintf(string format, params VariableArgument[] args) { if (!args.Any()) { return(format); } using (var combinedVariables = new CombinedVariables(args)) { var bufferCapacity = _vscprintf(format, combinedVariables.GetPtr()); var stringBuilder = new StringBuilder(bufferCapacity + 1); vsprintf(stringBuilder, format, combinedVariables.GetPtr()); return(stringBuilder.ToString()); } }