ET.
ET.

Reputation: 1969

Serializing an object containing a Bitmap i .NET Compact Framework

I am writing a project for Windows mobile 6 (.NET CF 3.5). My project contains a class that looks like this:

class MyClass {
    private Bitmap picture;
    //... and some other fields ...

    public MyClass ()
    {
        picture = new Bitmap (/*Picture file path*/);
        //...
    }
}

To my surprise, I found out that there is no binary formatter in the .NET CF. Does anyone know how can I serialize such object?? I tried to use CompactFormatterPlus - but it didnt worked.

Upvotes: 1

Views: 826

Answers (1)

ctacke
ctacke

Reputation: 67188

There are two ways to attack this.

  1. Manually serialize it. The Bitmap class has a Save method that can output to a Stream. You could send that to your serialization stream.
  2. Use a third-party option. I'd likely use protobuf-net.

Upvotes: 1

Related Questions