Nevron Open Vision Documentation
Data Formats

Data Formats Overview
A data format is represented by the NDataFormat class, for which you must only create singleton instances, if you need to define custom data formats. A data format is associated with each type of data that you want to publish or consume via a data object. A data format is a binary contract between the publisher and the consumer, that specifies how a binary data stream is converted into an object instance of some type and vice-versa. 
Predefined Data Formats

NOV comes with the following predefined data formats:

Because NOV hosts have knowledge of the predefined data formats, they automatically convert to-from native data exchange formats when such conversions are possible. For Microsoft Windows hosts such conversions are generally possible and this means that you can cut-copy-paste and drag-and-drop images, text and RTF content between NOV and other applications and vice versa (and yes you can cut-copy-paste from/to Microsoft Word).
Custom Data Formats

Besides the predefined data formats, you can also define custom formats, that can possibly exchange information between two different NOV application instances. To do so when declaring a data format you always need to provide a pair of serialize/deserialize delegates that serialize/deserialize your object instance to/from a byte array. The following code example declares a custom data format and implements a simple object, that can cross the application/process boundaries:

Example Title
Copy Code
public class MyFirstDataExchangeObject
    // make some sample fields
    public int IntValue;
    public float FloatValue;
    public MyFirstDataExchangeObject()
        FloatValue = 0;
        IntValue = 0;
    static MyFirstDataExchangeObject()
        // create the Data Format associated with MyFirstDataEchangeObject
        DataFormat = NDataFormat.Create("MyFirstDataEchangeFormat",
        new SerializeDataObjectDelegate(SerializeDataObject),
        new DeserializeDataObjectDelegate(DeserializeDataObject));
    // Serialization function for the data format
    private static byte[] SerializeDataObject(NDataFormat format, object obj)
        MyFirstDataExchangeObject myObject = (MyFirstDataExchangeObject)obj;
        Nevron.IO.NByteWriter byteWriter = new Nevron.IO.NByteWriter();
        return byteWriter.ToArray();
    // Deserialization function for the custom data format
    private static object DeserializeDataObject(NDataFormat format, byte[] bytes)
        MyFirstDataExchangeObject myObject = new MyFirstDataExchangeObject();
        Nevron.IO.NByteReader reader = new Nevron.IO.NByteReader(bytes);
        myObject.IntValue = reader.ReadInt32LE();
        myObject.FloatValue = reader.ReadSingleLE();
        return myObject;
     // reference to the singleton NDataFormat created by the static constructor of this type
    public static readonly NDataFormat DataFormat;
// publish a custom data exchange object to the clipboard
// make a custom data exchange object and assign arbitrary values
MyFirstDataExchangeObject obj = new MyFirstDataExchangeObject();
obj.FloatValue = 20.5f;
obj.IntValue = 10;
// make a data object and store the data exchange object in it
NDataObject dataObject = new NDataObject();
dataObject.SetData(MyFirstDataExchangeObject.DataFormat, obj);
// place the data object on the clipboard
// consume the custom data exchange object from the clipboard
// get a data object from the clipboard
NDataObject dataObject = NClipboard.GetDataObject();
// try get our custom data exchange object from the data object
MyFirstDataExchangeObject obj = (MyFirstDataExchangeObject)dataObject.GetData(MyFirstDataExchangeObject.DataFormat);
if (obj != null)
    // successfully obtained data exchange object from the clipboard
    // failed to obtained data exchange object from the clipboard
Are you tempted to use .NET serialization to serialize/deserialize the object? We strongly advise to never use the built-in .NET serialization, because of too many reasons, which are not a subject of this topic. NOV implements its own serialization engine, that you can use to serialize objects - see Serialization Overview for more info.
See Also
Send Feedback