473,385 Members | 1,806 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,385 software developers and data experts.

Deserialization Issue

I have a class that inherits from CollectionBase. My derived class raises
events whenever items are added or removed from the collection. When I try
to serialize my class I get errors because of any classes that are listening
for the events that are raised. And since it seems that the <NonSerialized>
attribute does not work for events in VB.NET I had to implement the
ISerializable interface.

I am able to serialize with no problems within the GetObjectData method. My
problem is in the protected constructor used when trying to deserialize the
class. I am trying to use the GetValue method but am getting a
TargetInvocation exception. I think it is because I am trying to use a
generic Object type when calling the method. I need to do this because I
have no idea beforehand what type of object was in the ArrayList when it was

Assuming that (in order) a String, Int32, and Single where written to the
stream during serialization, the following code does not work.

Dim obj As Object
List.Add(info.GetValue("Item0", obj.GetType))
List.Add(info.GetValue("Item1", obj.GetType))
List.Add(info.GetValue("Item2", obj.GetType))

But this code does:


How can I retrieve the collection of items that was in the ArrayList if I do
not know the TYPE of object it was when it was written.

- Jason
Jul 21 '05 #1
0 842

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

Similar topics

by: TEK | last post by:
There seems to be a bug when deserialization some classes in the .NET framework. If you try to deserialize a class that has a base class that holds a struct with a member that is implementing...
by: Mike Sarbu | last post by:
Hello all, I have an XML file like this: <?xml version="1.0" encoding="utf-8"?> <SomeObject xmlns="http://www.abcinc.com/objectdefinition"...
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database...
by: Nadav | last post by:
Hi, I have to read files generated by 3rd party application, these files are in a propriotary format ( not generated using the .NET framework ), I want to implement a custom DeSerializer to read...
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
by: parrot toes | last post by:
I tried to post this question before, but there was an error when posting. I case it did get posted and in order to avoid duplication, I'll just repost a summary. I have written a dotnet client...
by: frustratedWithDotNet | last post by:
Why does .NET not issue messages or throw exceptions if it doesn't like something in the response from a web service?? I am getting a response object, but an array of custom objects within the...
by: yoshijg | last post by:
Is there a way to be notified when the deserialization of an XML is complete, like a callback method? I tried the IDeserializationCallback interface, but that doesnt for XML-Deserialization. ...
by: John Glover | last post by:
To whoever can help, I've been having a problem with XML deserialization lately. I needed to serialize and deserialze two objects which inherited from Hashtable. Because IDictionary...
by: anand sancheti | last post by:
I was trying to return a generic collection on my webmethod. Things work fine If i visit webservice from browser i.e. it shows the proper content of the collection<T> in XML, but when I try to...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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$) { } ...
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...
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...
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...
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...

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.