Click here to Skip to main content
15,895,667 members
Articles / Programming Languages / C#

A Fast/Compact Serialization Framework

Rate me:
Please Sign up or sign in to vote.
4.85/5 (37 votes)
13 Oct 2010GPL35 min read 284.1K   1.2K   175  
A framework for object serializiation/deserialization that is many times faster and yields a compact output.
<html dir="LTR">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>NxBinaryFormatter Class</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />
  </head>
  <body id="bodyID" class="dtBODY">
    <div id="nsbanner">
      <div id="bannerrow1">
        <table class="bannerparthead" cellspacing="0">
          <tr id="hdr">
            <td class="runninghead">OpenNxSerialization API Reference</td>
            <td class="product">
            </td>
          </tr>
        </table>
      </div>
      <div id="TitleRow">
        <h1 class="dtH1">NxBinaryFormatter Class</h1>
      </div>
    </div>
    <div id="nstext">
      <p> Serializes and deserializes an object, or an entire graph of connected objects, in binary format. Uses the compact serialization framework to achieve better stream size and cpu time utlization. </p>
      <p>For a list of all members of this type, see <a href="NeXtreme.OpenNxSerialization.Formatters.NxBinaryFormatterMembers.html">NxBinaryFormatter Members</a>.</p>
      <p>
        <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemObjectClassTopic.asp">System.Object</a>
        <br />���<b>NxBinaryFormatter</b></p>
      <div class="syntax">
        <span class="lang">[Visual�Basic]</span>
        <br />Public�Class�NxBinaryFormatter<div>����Implements�<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingMessagingIRemotingFormatterClassTopic.asp">IRemotingFormatter</a>, <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeSerializationIFormatterClassTopic.asp">IFormatter</a></div></div>
      <div class="syntax">
        <span class="lang">[C#]</span>
        <div>public�class�NxBinaryFormatter<b> : <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingMessagingIRemotingFormatterClassTopic.asp">IRemotingFormatter</a>, <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeSerializationIFormatterClassTopic.asp">IFormatter</a></b></div>
      </div>
      <H4 class="dtH4">Thread Safety</H4>
      <P>Public static (<b>Shared</b> in Visual Basic) members of this type are 
				safe for multithreaded operations. Instance members are <b>not</b> guaranteed to be 
				thread-safe.</P>
      <h4 class="dtH4">Remarks</h4>
            <p> The basic idea behind space conservation is that every 'known type' is assigned a 2-byte type handle by the system. Native .NET serialization stores the complete type information with serialized object data, which includes assembly, version and tokens etc. Instead of storing such information only a type handle is stored, which lets the system uniquely identify 'known types'. A known type is a type that is registered with the <a href="NeXtreme.OpenNxSerialization.INxTypeSurrogateSelector.html">INxTypeSurrogateSelector</a>. Moreover surrogate types take care of serializing only the required information. Information related to fields and attributes is not stored as in case of native serialization. </p>
            <p> From performance's perspective reflection is avoided by using surrogates for types. A type surrogate is intimate with the internals of a type and therefore does not need reflection to guess object schema. </p> For types that are not known to the system the formatter reverts to the default .NET serialization scheme. <h4 class="dtH4">Requirements</h4><p><b>Namespace: </b><a href="NeXtreme.OpenNxSerialization.Formatters.html">NeXtreme.OpenNxSerialization.Formatters</a></p><p><b>Assembly: </b>NeXtreme.OpenNxSerialization (in NeXtreme.OpenNxSerialization.dll)
					</p><h4 class="dtH4">See Also</h4><p><a href="NeXtreme.OpenNxSerialization.Formatters.NxBinaryFormatterMembers.html">NxBinaryFormatter Members</a> | <a href="NeXtreme.OpenNxSerialization.Formatters.html">NeXtreme.OpenNxSerialization.Formatters Namespace</a></p><hr /><div id="footer"><p><a>Copyright (C) 2006 - 2008, NeXtreme Innovations. All rights reserved.</a></p><p>Generated from assembly NeXtreme.OpenNxSerialization [1.5.0.0]</p></div></div>
  </body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Architect
Pakistan Pakistan
Let a = b ....... (1)
a - b = a - b
a^2 - ab = a^2 - ab
a^2 - ab = a^2 - b^2 (from 1)
a (a - b) = (a + b) (a - b)
a = (a + b) ...... (2)

if a = 1
1 = (1 + 1) (from 1 & 2)
1 = 2 !!

Comments and Discussions