Networkcomms.net2.3.1 Open source version, based on GPL V3 protocol. Because the 3.x version of the source code can not be published, so based on this version of learning.3. There are many improvements and bug fixes in the X version, and there is little difference in how to use them. /*Please note that the following code is required to comply with the GPLV3 protocol*/#ifWindows_phone#elseusingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Runtime.Serialization.Formatters.Binary;usingSystem.IO;#ifAndroidusingPreserveattribute =Android.Runtime.PreserveAttribute;#elifIosusingPreserveattribute =MonoTouch.Foundation.PreserveAttribute;#endifnamespacedpsbase{///. NET comes with a serializer/// </summary>[Dataserializerprocessor (2)] Public classBinaryformaterserializer:dataserializer {StaticDataserializer instance; [Obsolete ("Instance access via class obsolete, use dpsmanager.getserializer<t>")] Public StaticDataserializer Instance {Get { if(Instance = =NULL) Instance= getinstance<binaryformaterserializer>(); returninstance; } }#ifANDROID | | Ios[Preserve]#endif PrivateBinaryformaterserializer () {}#regionIserialize Members/// <inheritdoc/> ///serializing objects into binary data protected Override voidSerialisedataobjectint (Stream Ouputstream,ObjectObjecttoserialise, dictionary<string,string>options) {BinaryFormatter Formatter=NewBinaryFormatter (); Formatter. Serialize (Ouputstream, objecttoserialise); Ouputstream.seek (0,0); } /// <inheritdoc/> ///serializing binary data into objects protected Override ObjectDeserialisedataobjectint (Stream InputStream, Type Resulttype, dictionary<string,string>options) {BinaryFormatter Formatter=NewBinaryFormatter (); returnFormatter. Deserialize (InputStream); } #endregion }}#endifhttp://Www.cnblogs.com/networkcommshttp//www.networkcoms.cn Edit
Binaryformaterserializer Class (Networkcomms 2.3.1 source knowledge and learning)