SimpleSerialize Sample

Sample Overview

This sample shows how to serialize a graph of objects using the serialization infrastructure and binary serialization. A simple class inherited from the ArrayList class is filled with instances of a simple struct.  The object is serialized to a binary file named objectgraph.bin using a BinaryFormatter object and then deserialized.

Sample Source and Build Output Locations

The sample source is found in rotor\samples\howto\serialization\simpleserialize.

The source file is:

The build output location is %TARGETCOMPLUS%\samples\serialization.  The output file is an executable assembly named simpleserialize.exe.

Building the Sample

All samples are built from the buildall script. 

You can also build all the samples by switching to the root of the sample directory, sscli\samples, and typing build -c.

You can build this specific sample by switching to the sample directory and typing build -c.

Running the Sample

These steps require that the Shared Source CLI (SSCLI) be already built and functional.

  1. Run
  2. env.bat or source the env.csh or env.sh script files, depending on your platform.
  3. Switch to the %TARGETCOMPLUS%\samples\serialization directory.
  4. Type the following command:

    clix simpleserialize.exe


Copyright (c) 2002 Microsoft Corporation. All rights reserved.