473,804 Members | 3,894 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about serialization w/ class inheritence.

If I have a base class that is derived from many classes, and I want to make
all the classes serializable. Is there a way I can do this from the base
class or must I add [Serializable()] to every class, even if it's parent
class has the [Serializable()] attribute.
I'm thinking no from what I've seen on google so far.
Nov 15 '05 #1
2 1580
Hasani,
As you are finding each serializable class needs the Serializable attribute,
even when derived from classes that already have the Serializable attribute.

In case you don't have them the following MSDN Magazine articles are useful
for understanding Serialization.

http://msdn.microsoft.com/msdnmag/issues/02/04/net/
http://msdn.microsoft.com/msdnmag/issues/02/07/net/
http://msdn.microsoft.com/msdnmag/issues/02/09/net/

Binary serialization is going to use less space then SOAP Serialization.
SOAP serialization is really intended for Web Services (SOAP). There is also
XML serialization which is not tied directly to SOAP Serialization, however
you get a similar result.

Hope this helps
Jay
"Hasani" <bi*******@hax0 r.dyndns.org> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
If I have a base class that is derived from many classes, and I want to make all the classes serializable. Is there a way I can do this from the base
class or must I add [Serializable()] to every class, even if it's parent
class has the [Serializable()] attribute.
I'm thinking no from what I've seen on google so far.

Nov 15 '05 #2
Good Find
Thx
"Jay B. Harlow [MVP - Outlook]" <Ja********@ema il.msn.com> wrote in message
news:uO******** ******@tk2msftn gp13.phx.gbl...
Hasani,
As you are finding each serializable class needs the Serializable attribute, even when derived from classes that already have the Serializable attribute.
In case you don't have them the following MSDN Magazine articles are useful for understanding Serialization.

http://msdn.microsoft.com/msdnmag/issues/02/04/net/
http://msdn.microsoft.com/msdnmag/issues/02/07/net/
http://msdn.microsoft.com/msdnmag/issues/02/09/net/

Binary serialization is going to use less space then SOAP Serialization.
SOAP serialization is really intended for Web Services (SOAP). There is also XML serialization which is not tied directly to SOAP Serialization, however you get a similar result.

Hope this helps
Jay
"Hasani" <bi*******@hax0 r.dyndns.org> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
If I have a base class that is derived from many classes, and I want to

make
all the classes serializable. Is there a way I can do this from the base
class or must I add [Serializable()] to every class, even if it's parent
class has the [Serializable()] attribute.
I'm thinking no from what I've seen on google so far.


Nov 15 '05 #3

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

Similar topics

17
2483
by: Dave | last post by:
Hi I'm making a 3D Engine which consists of the class C3DEngine. Part of this engine is a file loader, a class called CMeshLoader. I have made an instance of CMeshLoader in C3DEngine, ie composition. Unfortunately, CMeshLoader sometimes needs to refer to private members of C3DEngine. Inheritance, friends, and composition are all swirling around in my head at the moment. I know that inheritance is not the solution. Can someone please...
0
2962
by: uAsking | last post by:
I'm building a client side application that uses webservices. In the client application I'm inheriting from basic types used by the webservices, so the wevservice provides the classes and sets all the serialization attributes for them. The classes are in a very basic structure with a Single object that contains two other objects. I inhert from them and add a function with converts the object returned from the webservice into my object...
8
1455
by: ^MisterJingo^ | last post by:
Hi all, I have a question regarding inheritance. I'll use the following code for an example (its been stripped down to the minimum): // code start using System; class Animal {
11
1458
by: jason | last post by:
we have developed a .NET class library that defines a family of reusable business objects. the class library is developed in C#, and works quite well. one problem, however, is that as more and more applications are being developed to consume this class library, we are running into deployment and version controll issues. i recall a lot of this kind of thing being solved with distributed application models, such as the EJB...
2
1437
by: Evian Spring | last post by:
We are planning on using "SqlServer" mode for our ASP.NET session state. I know for the classes we store in Session that I need to mark them with the SerializableAttribute as described in this knowledge base article: http://support.microsoft.com/default.aspx?scid=KB;EN-US;q312112&ID=KB;EN-US;q312112 My question is, if I store in session a class that contains members
10
1209
by: Frank Millman | last post by:
Hi all I recently posted a question about subclassing. I did not explain my full requirement very clearly, and my proposed solution was not pretty. I will attempt to explain what I am trying to do more fully, and describe a possible solution. It is still not pretty, so I would appreciate any comments. I have a base class (ClassA), which is an abstract class. Most of the methods and attributes are common to all subclasses, so there is...
3
2112
by: Roy Chastain | last post by:
I have a schema that has been in existence over 1 year. I have been making a few minor modifications to it recently and suddenly the generated C# classes have made a radical change. I have just compared the xsd source to the last compiled version on 8/25/06 and they are identical, yet the generated C# is different. I do not know enough about XSD and schemas to understand how the original output was generated, but I need to get it back. ...
0
1809
by: groovyghoul | last post by:
Hi I have the following XML file: =========================================================== <?xml version="1.0" encoding="UTF-16"?> <Policy xmlns="http://tempuri.org/richard.xsd"> <TransType /> <LOB /> <Name> <FirstName />
8
1404
by: Casper | last post by:
Hi, i read several articles about serialization. I know now that it is a process of converting an object into a stream of data so that it can be is easily transmittable over the network or can be continued in a persistent storage location. Now i did some tests in order to understand it better: I first executed the code below (this (summarized) code produces a virtual simple shopping cart which is put in the Profile of the user) with...
0
10593
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.