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

Nested Serialization

When you use the [Serializable] tag are nested classes also serialized?

If so, can you just use a [NonSerialized] tag to exclude them from the
stream?
Nov 15 '05 #1
2 7831
Chuck,

If a class is nested, it only means that the class is defined within
another class. This is not serialized unless the parent class holds a
reference to an instance of the nested class.

If you want to prevent a field from being serialized, then you can place
the NonSerialized attribute on the field to keep it from being serialized.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
When you use the [Serializable] tag are nested classes also serialized?

If so, can you just use a [NonSerialized] tag to exclude them from the
stream?

Nov 15 '05 #2
Thanks Nicholas.

I would have tested it myself but figured somebody here would probably know
without going thru the trouble...

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
Chuck,

If a class is nested, it only means that the class is defined within
another class. This is not serialized unless the parent class holds a
reference to an instance of the nested class.

If you want to prevent a field from being serialized, then you can place the NonSerialized attribute on the field to keep it from being serialized.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
When you use the [Serializable] tag are nested classes also serialized?

If so, can you just use a [NonSerialized] tag to exclude them from the
stream?


Nov 15 '05 #3

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

Similar topics

3
by: Leszek | last post by:
Hello, I have the following XML file: <events> <event name="event1"> <sessions> <session date="23 Feb 2004" time="10:00 - 15:00" location="Toronto" /> </sessions> </event>
2
by: David Elliott | last post by:
I can create this: ?xml version="1.0" standalone="yes" ?> <ConfigOpt> <record> <Field_1>Text # 1</Field_1> <Field_2>Text # 2</Field_2> </record> </ConfigOpt>
0
by: Woody | last post by:
I need to group some attribute for use in different types, but if I nest an attributegroup inside another one I miss the nested attribute in class generated with xsd.exe. For example if I use the...
1
by: Edward Diener | last post by:
I want to create a nested class within my component class. The nested class will have public properties. Naturally I want those properties to be serialized just as those properties of my component...
1
by: Rick Luckwell | last post by:
I have 3 collections(reports, services, charts) of objects(report, service, chart) that are nested with each other. When I serialize the object the output only contains reports and services but...
1
by: chrisfost | last post by:
Is it possible by using attributes to serialize a <List<List<Point>> property to output as shown below? Current Output <PolyPolyline> <ArrayOfPoint> <Point> <X>5</X> <Y>5</Y>
4
by: LW | last post by:
Hi! I have a DataSet and a class in my Web Service. My output for example is: <OrderInfo> <CustomerID>VINET</CustomerID> <OrderID>10248</OrderID> <OrderDate>07/07/1996</OrderDate>...
4
by: =?Utf-8?B?Qnlyb24=?= | last post by:
When I try to serialize an instance of the LocationCell below (note Building field) I get an error in the reflection attempt. If I remove the _Building field it serializes fine. I tried renaming...
1
by: kikisan | last post by:
I am developing a windows service which utilizes the following classes: interface IPersistable; abstract class PersistableObject : IPersistable;
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.