473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Implementing a serialization formatter

Hi,

I am trying to implement my own formatter that implements and adheres
to the standards of the IFormatter interface. I have run into a bit of
an issue trying to serialize classes that implement the ISerializable
interface. Specifically, I don't know how to repopulate the members
(via the special New constructor). The MSDN documentation for the
FormatterServices.PopulateObjectMembers function claims that:

"if the object implements ISerializable, the populating is handed off
to the object itself. If a matching surrogate is not found, and the
object does not implement the ISerializable interface, then
deserialization populates each field listed in members, with the
corresponding value listed in data."

Based on this, I figure I need to call this method to populate the
data for classes that implement ISerializable. What I can't figure out
is what to pass for the "members()" parameter. It expects an array of
MemberInfo objects, but I can't construct those, the constructor is
protected. I even tried to create my own class that inherits from
MemberInfo, but it just threw an error when I passed it in saying:

"An unhandled exception of type
'System.Runtime.Serialization.SerializationExcepti on' occurred in
mscorlib.dll
Additional information: Only FieldInfo, PropertyInfo, and
SerializationMemberInfo are recognized."

Does anyone have any ideas as to how I can get around this? Does
anyone know what a SerializationMemberInfo is?

Thanks,
Scott.
Jul 21 '05 #1
0 973

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: reycri | last post by:
I have a .Net class (a collection) that already supports serialization. It implements ISerializable... Now, I need it to also support the COM interface IPersistStream. Among other things, I need...
1
by: Eric Workman | last post by:
Hi Everyone- I would like to implement the IFormatter class to create a custom formatter that essentially does exactly what the System.Xml.Serialization.XmlSerializer does, but also would allow...
2
by: Mike | last post by:
Hello. I am using C# in .NET v1.1. I am trying to serialize an object to disk and read it back again. The serialization seems to work OK (at least, it completes without error). However, I get...
3
by: Frans Bouma | last post by:
Hi, I have a serious problem with VB.NET and a DataTable derived class and I can't figure out how to solve it. I have implemented it in C# where it works perfectly, but I can't port one...
2
by: andreas | last post by:
Hi, if have a object arrSdList of type SortedList for serialization and deserialization there are two subs for doing this Public Sub deser Dim Formatter As BinaryFormatter = New...
2
by: Peter | last post by:
Hi, If I Serialized a instance of class zCMethod and then deserialized it, no error occurs. Now ,I Serialized a instance of class InheritedCMethod and then deserialized it, I got an error....
0
by: Scott Ure | last post by:
Hi, I am trying to implement my own formatter that implements and adheres to the standards of the IFormatter interface. I have run into a bit of an issue trying to serialize classes that...
5
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
2
by: Norman Chong | last post by:
Hiddeldi ho, I want to save an object so that I can use its content after I restart my program. I tried to solve this with serialization because someone told me that this is the correct way for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.