Use the methods provided by TextWriter or fprintf instead of sprintf so that we avoid creating unnecessary strings (by writing the formatted values directly to the TextWriter).