Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. How do I Convert Struct to ByteArray in .net 2005

How do I Convert Struct to ByteArray in .net 2005

Scheduled Pinned Locked Moved Managed C++/CLI
csharpdata-structureshelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ShayD1
    wrote on last edited by
    #1

    All I need to do is to send a structure via SerialPort Control which needs in return an array of Bytes, and then convert it back on the other side! Can anyone help me here :( I am getting pretty desperate here :(( Thanks

    2 1 Reply Last reply
    0
    • S ShayD1

      All I need to do is to send a structure via SerialPort Control which needs in return an array of Bytes, and then convert it back on the other side! Can anyone help me here :( I am getting pretty desperate here :(( Thanks

      2 Offline
      2 Offline
      2bee
      wrote on last edited by
      #2

      Hello, you might want to give the BinaryFormatter class a try. It allows you to serialize and deserialize objects to and from a stream. As far as i know you could then retrieve the buffer from it or even write the stream to the serial port. You will find it in this namespace: System::Runtime::Serialization::Formatters::Binary; Anyway, I cannot guarantee that it will actually work, because i haven't had the time yet to test it by my own. Best regards Tobias

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups