I have an object that serializes back and forth.
I would like to have some objects not serialize ..and when
I read that info back into the class, have this item be
null ( or something like it ).
I modified a class I made by XSD.exe by adding these
values ( drvltr, disknum) , but I found when I wrote the
class out to file and retrieved it, the values were
persisted.
If this is reasonable, how do I approach it ? Thanks
In the example below, the tool inserts the declaration
[System.Xml.Serialization.XmlAttributeAttribute()]
for each attribute. Therefore I added the the attributes
drvltr and disknum because I reasoned maybe without the
declaration, they would be ignored.
[System.Xml.Serialization.XmlAttributeAttribute()]
public string uniqueid;
public string drvltr;
public string disknum; 6 2011
Hi Andrew,
To exclude a field of a class when serializing, you can add the following
attribute before the declaration of this memeber variable. For example, if
you don't want "disknum" to be serialized, you can try the following code:
[System.NonSerialized()]
public string disknum;
This attribute only affects on the declaration of "disknum", and will be
ignored on latter fields.
Does this answer your question? If anything is unclear, please feel free to
reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| Content-Class: urn:content-classes:message
| From: "andrewcw" <an************@boeing.com>
| Sender: "andrewcw" <an************@boeing.com>
| Subject: mixed XML serialization
| Date: Sun, 5 Oct 2003 20:01:54 -0700
| Lines: 23
| Message-ID: <00****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcOLtjJlFwrQ4RTLS9eveNRajrJ6Ew==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:189133
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have an object that serializes back and forth.
| I would like to have some objects not serialize ..and when
| I read that info back into the class, have this item be
| null ( or something like it ).
|
| I modified a class I made by XSD.exe by adding these
| values ( drvltr, disknum) , but I found when I wrote the
| class out to file and retrieved it, the values were
| persisted.
|
| If this is reasonable, how do I approach it ? Thanks
|
| In the example below, the tool inserts the declaration
| [System.Xml.Serialization.XmlAttributeAttribute()]
| for each attribute. Therefore I added the the attributes
| drvltr and disknum because I reasoned maybe without the
| declaration, they would be ignored.
|
| [System.Xml.Serialization.XmlAttributeAttribute()]
| public string uniqueid;
| public string drvltr;
| public string disknum;
|
|
Hi Andrew,
To exclude a field of a class when serializing, you can add the following
attribute before the declaration of this memeber variable. For example, if
you don't want "disknum" to be serialized, you can try the following code:
[System.NonSerialized()]
public string disknum;
This attribute only affects on the declaration of "disknum", and will be
ignored on latter fields.
Does this answer your question? If anything is unclear, please feel free to
reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| Content-Class: urn:content-classes:message
| From: "andrewcw" <an************@boeing.com>
| Sender: "andrewcw" <an************@boeing.com>
| Subject: mixed XML serialization
| Date: Sun, 5 Oct 2003 20:01:54 -0700
| Lines: 23
| Message-ID: <00****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcOLtjJlFwrQ4RTLS9eveNRajrJ6Ew==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:189133
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have an object that serializes back and forth.
| I would like to have some objects not serialize ..and when
| I read that info back into the class, have this item be
| null ( or something like it ).
|
| I modified a class I made by XSD.exe by adding these
| values ( drvltr, disknum) , but I found when I wrote the
| class out to file and retrieved it, the values were
| persisted.
|
| If this is reasonable, how do I approach it ? Thanks
|
| In the example below, the tool inserts the declaration
| [System.Xml.Serialization.XmlAttributeAttribute()]
| for each attribute. Therefore I added the the attributes
| drvltr and disknum because I reasoned maybe without the
| declaration, they would be ignored.
|
| [System.Xml.Serialization.XmlAttributeAttribute()]
| public string uniqueid;
| public string drvltr;
| public string disknum;
|
|
Thanks - that is exactly what I needed to know !!! -----Original Message----- Hi Andrew,
To exclude a field of a class when serializing, you can
add the followingattribute before the declaration of this memeber
variable. For example, ifyou don't want "disknum" to be serialized, you can try
the following code: [System.NonSerialized()] public string disknum;
This attribute only affects on the declaration
of "disknum", and will beignored on latter fields.
Does this answer your question? If anything is unclear,
please feel free toreply to the post.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and
confers norights."
-------------------- | Content-Class: urn:content-classes:message | From: "andrewcw" <an************@boeing.com> | Sender: "andrewcw" <an************@boeing.com> | Subject: mixed XML serialization | Date: Sun, 5 Oct 2003 20:01:54 -0700 | Lines: 23 | Message-ID: <00****************************@phx.gbl> | MIME-Version: 1.0 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Thread-Index: AcOLtjJlFwrQ4RTLS9eveNRajrJ6Ew== | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | Newsgroups: microsoft.public.dotnet.languages.csharp | Path: cpmsftngxa06.phx.gbl | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.languages.csharp:189133| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp | | I have an object that serializes back and forth. | I would like to have some objects not serialize ..and
when| I read that info back into the class, have this item be | null ( or something like it ). | | I modified a class I made by XSD.exe by adding these | values ( drvltr, disknum) , but I found when I wrote
the| class out to file and retrieved it, the values were | persisted. | | If this is reasonable, how do I approach it ? Thanks | | In the example below, the tool inserts the declaration | [System.Xml.Serialization.XmlAttributeAttribute()] | for each attribute. Therefore I added the the
attributes| drvltr and disknum because I reasoned maybe without the | declaration, they would be ignored. | | [System.Xml.Serialization.XmlAttributeAttribute()] | public string uniqueid; | public string drvltr; | public string disknum; | |
.
Hi Andrew,
"andrewcw" <an************@boeing.com> wrote in message
news:23*****************************@phx.gbl... Kevin, something is not right, I modified the class file and it wrote out the fields and read them back in: here's what that portion of the class now reads: { What could be the cause of that ??? } THANKS
<snip>
Use the "XmlIgnore" attribute on the field. The XmlIgnore attribute
refers to XML serialization, whereas the NonSerialized attribute refers to
binary serialization.
Regards,
Dan
Thanks - I tested that and it worked:
[XmlIgnoreAttribute]
public string disknum; -----Original Message----- Hi Andrew,
"andrewcw" <an************@boeing.com> wrote in message news:23*****************************@phx.gbl... Kevin, something is not right, I modified the class
file and it wrote out the fields and read them back in: here's what that portion of the class now reads: { What could be the cause of that ??? } THANKS<snip>
Use the "XmlIgnore" attribute on the field. The
XmlIgnore attributerefers to XML serialization, whereas the NonSerialized
attribute refers tobinary serialization.
Regards, Dan
.
Thanks, Daniel.
Andrew, apologize for my mistake.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| Content-Class: urn:content-classes:message
| From: "andrewcw" <an************@boeing.com>
| Sender: "andrewcw" <an************@boeing.com>
| References: <00****************************@phx.gbl>
<MP**************@cpmsftngxa06.phx.gbl>
<23*****************************@phx.gbl>
<OV**************@TK2MSFTNGP12.phx.gbl>
| Subject: Re: mixed XML serialization
| Date: Mon, 6 Oct 2003 11:23:07 -0700
| Lines: 29
| Message-ID: <05****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOMNuQWrsIp/RrBSv6Q4v3XXQ5FIg==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:189332
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thanks - I tested that and it worked:
| [XmlIgnoreAttribute]
| public string disknum;
|
| >-----Original Message-----
| >Hi Andrew,
| >
| >"andrewcw" <an************@boeing.com> wrote in message
| >news:23*****************************@phx.gbl...
| >>
| >> Kevin, something is not right, I modified the class
| file
| >> and it wrote out the fields and read them back in:
| >> here's what that portion of the class now reads: { What
| >> could be the cause of that ??? } THANKS
| ><snip>
| >
| > Use the "XmlIgnore" attribute on the field. The
| XmlIgnore attribute
| >refers to XML serialization, whereas the NonSerialized
| attribute refers to
| >binary serialization.
| >
| >Regards,
| >Dan
| >
| >
| >.
| >
| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Perttu Pulkkinen |
last post by:
No questions, but just consider if this is useful to you:-) but of course
feedback & corrections are welcome.
function php_mixed_to_js_value($jsname, $mixed)
{
if(is_null($mixed))
{ return "\n...
|
by: andrewcw |
last post by:
I have an object that serializes back and forth.
I would like to have some objects not serialize ..and when
I read that info back into the class, have this item be
null ( or something like it ).
...
|
by: Aaron Clamage |
last post by:
Hi,
I'm not sure that if this is the right forum, but any help would be greatly
appreciated.
I am porting some java serialization code to c# and I can't figure out the
correct way to do it. ...
|
by: Edward Diener |
last post by:
I received no answers about this the first time I posted, so I will try
again. My inability to decipher an MSDN topic may find others who have the
same inability and someone who can decipher and...
|
by: Edward Diener |
last post by:
By reuse, I mean a function in an assembly which is called in another
assembly.
By a mixed-mode function I mean a function whose signature has one or
more CLR types and one or more non-CLR...
| |
by: Bern McCarty |
last post by:
I know how with VC8 you embed your linker generated manifest into an exe
with a resource ID of #1 and into a dll with resource ID #2. But what do
you do with the linker generated manifest for a...
|
by: andrew_nuss |
last post by:
Hi,
Lets say I have a MIXED tag in my XML DTD with content that is going
to be rendered as HMTL, as well as a <boldand <italicstag. What
about whitespace? Specifically, does the whitespace in...
|
by: kikisan |
last post by:
I am developing a windows service which utilizes the following classes:
interface IPersistable;
abstract class PersistableObject : IPersistable;
|
by: mkvenkit.vc |
last post by:
Hello,
I hope this is the right place to post a question on Boost. If not,
please let me know where I can post this message and I will do so.
I am having a strange problem with std::string as...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
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: 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,...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |