1) It's absolutely not a problem to send any kind of data to a COM port using .NET (#C or not):
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[
^], see
Write
members.
2) If something can read a number (what size, though?), it means it can read a string. It depends on string encoding though. If you can use ASCII, each character is encoded as one byte, and all string encoding formats are Unicode UTFs; UTF88 is byte-oriented, UTF16 presents a character as one 16-bit word or a pair of them (called surrogate pair), UTF32 presents a character as one 32-bit word. When you write
WritelLine("123")
you send 5 16-bit words (line is represented with the characters 13, 10 (LF, CR)), because in CLI memory strings are represented in UTF16LE encoding. Most likely, this is not what expected. You can always serialize a string as required using on of the
System.Text.Encoding
classes. Please see:
http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[
^].
—SA