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

VB.NET, Events, and Serialization

I have a class which inherits from CollectionBase. My version adds events to
notify client whenever items are added or removed from the collection. I
wrote it in VB.NET.

If I have a class which creates an instance of the collection and adds
handlers to the events it raises, and then try to serialize the collection I
get an error about the client not being marked as serialized. This is
because of the reference the collection maintains (actually its delegate if
I understand it correctly) to any clients receiving its events. I tried to
marked the events as NonSerialized but that does not work since the
attribute can only be used on fields. So my solution was to implement
ISerializable but I could not get the deserialization to work since a
collection can have any type of object and when you are reading it back in
you do not know how to cast it.

This leads up to my actual question. Is there a way to look at an instance
of an object and find out who is listening for its events? More specially,
can I remove all the listeners from the events list if I just have a
reference to the collection object?

- Jason
Jul 21 '05 #1
0 1037

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

Similar topics

3
by: mikeb | last post by:
I have a class (settings, etc.) which is derived from CollectionBase and contains a number of fields and a few events. When I create an instance of this class in my app, and serialize it, it works....
0
by: jan v | last post by:
Hi everyone I have a problem with events. When the code reaches communication.SynchronisationServer.UpdateNotificationEvent+=new...
5
by: Neil Norfolk | last post by:
I am using C# in Visual Studio 2003. I would like to serialize a class that contains, amongst other things, public delegate void DocumentsPreferencesChange(object env, Documents e); public event...
0
by: Nigel Armstrong | last post by:
Hi All If I have a type that contains an event, then serialization tries to serialize the delegate and its invocation list - not good. In C#, I can write code like this (follows) - note the...
0
by: Jason | last post by:
I have a class which inherits from CollectionBase. My version adds events to notify client whenever items are added or removed from the collection. I wrote it in VB.NET. If I have a class which...
0
by: Jason | last post by:
I have a class which inherits from CollectionBase. My version adds events to notify client whenever items are added or removed from the collection. I wrote it in VB.NET. If I have a class which...
7
by: nick.fletcher | last post by:
I have a custom collection which derives from Collection<which stores a number of objects. Before each item is added to the collection - an event which it exposes is hooked by the collection and...
0
by: shivkumar2004 | last post by:
Hi, I m getting the following error while registering the events on client appl. error: "An error occurred creating the form. See Exception.InnerException for details. The error is: Exception...
6
by: Smithers | last post by:
Just looking to compile a list of "all the ways to implement events". I'm NOT looking to get into the merits or mechanics of each in this thread... just want to identify them all - good, bad, and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.