I have a situation where I need to convert a long to a character array without allocating any new objects. I want to mimic what is done in long.ToString() without actually creating a string object, basically - instead the characters will be inserted into a predefined array. I feel like this should be pretty straightforward, but I can't find any examples - everything in C# uses something like ToString or String.Format, everything in C++ uses either stringstream, sprintf, or ltoa. Any ideas?
edit: For a little clarify, this is part of a critical section of frequently called code that cannot withstand garbage collection, hence I don't want to allocate additional strings. The output is actually placed into a byte array - but the receiver of this data expects a byte array of the character representation of this long, so I'm attempting to reduce garbage collection by doing the conversion to string format without allocating a new object.