locked
How do i serialize a simpmple string on .net compact 3.5 RRS feed

  • Question

  • Hi,


         Im writing a mobile app on .net compact 3.5 and ive just realised that there is no support for binary serialization. I cant use the BinaryFormatter method as its not included in the class library.

    So this leaves me with custom serialization. The application im writing is very simple, its just a proof of concept. The string im sending is just simply "go". This will be the only comand my client app (on a mobile device) sends to a sever app (with a running socket listener)  sitting on my pc.

    any suggestions of how i can serialize this string? any links to source code or other suggestions of how i could send this command to my PC using wifi (the simpler the better)?

    many thanks
    Tuesday, November 17, 2009 6:37 PM

Answers

  • string myString = BitConverter.GetString(bytes, 0, bytes.Length);
    If You'll find my answer satisfactory or helpful - mark it as answered or vote for it! Thank You.
    "If You think You know better then me, why is Your code not working, then don't waste my time at this forum. Otherwise - do as I'm suggesting."

    I'm on MSDN just like MD House in the clinic. But I'm also a human which sometimes needs to see another doctor :)
    • Proposed as answer by Mal Loth Wednesday, November 18, 2009 7:09 AM
    • Marked as answer by Jsnow2008 Wednesday, November 18, 2009 7:24 PM
    Wednesday, November 18, 2009 7:09 AM

All replies

  • byte[] bytes = BitConverter.GetBytes("go");
    If You'll find my answer satisfactory or helpful - mark it as answered or vote for it! Thank You.
    "If You think You know better then me, why is Your code not working, then don't waste my time at this forum. Otherwise - do as I'm suggesting."

    I'm on MSDN just like MD House in the clinic. But I'm also a human which sometimes needs to see another doctor :)
    • Proposed as answer by Mal Loth Tuesday, November 17, 2009 7:14 PM
    Tuesday, November 17, 2009 7:14 PM
  • Ah thats great, how do i de-serialize it at the other end?
    Tuesday, November 17, 2009 11:07 PM
  • string myString = BitConverter.GetString(bytes, 0, bytes.Length);
    If You'll find my answer satisfactory or helpful - mark it as answered or vote for it! Thank You.
    "If You think You know better then me, why is Your code not working, then don't waste my time at this forum. Otherwise - do as I'm suggesting."

    I'm on MSDN just like MD House in the clinic. But I'm also a human which sometimes needs to see another doctor :)
    • Proposed as answer by Mal Loth Wednesday, November 18, 2009 7:09 AM
    • Marked as answer by Jsnow2008 Wednesday, November 18, 2009 7:24 PM
    Wednesday, November 18, 2009 7:09 AM
  • Thanks :)
    Wednesday, November 18, 2009 7:25 PM