That code only accounts for the space not things like carriage return backspace or even the EOL character that would be submitted if they were actually able to return nothing at all.
~
If C# has some sort of library function for this look it up at msdn. Otherwise you could create a function that test the beginning char value for an escape sequence (ASCII list).
But I'm sure C# does have a function for testing for escape sequences.