473,385 Members | 2,004 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.

SoapFormatter not outputing properties

Hi, I have a class derived from ApplicationException as below (excuse
formatting):

[Serializable()]

public class MyException : ApplicationException {

public string CompanyName {

get {return Application.CompanyName;}

}

public string ProductName {

get {return Application.ProductName;}

}

public string ProductVersion {

get {return Application.ProductVersion;}

}

}

I am serializing it as follows:

IFormatter formatter = new SoapFormatter();

Stream stream = new FileStream(dlgSave.FileName, FileMode.Create,
FileAccess.Write, FileShare.None);

formatter.Serialize(stream, _ex);

stream.Close();

However, the extra properites I have added to the class are not getting
output. How come?

Thanks.
Nov 11 '05 #1
1 1432
The SoapFormatter does not serialize properties, it only serializes the
fields that reflect the actual state of the object.

The XmlSerializer behaves the way you are looking for. It has a bunch of
other limitations though, so be careful before you switch from one to the
other.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"James Willock" <ja***@dot.com> wrote in message
news:Ox**************@TK2MSFTNGP11.phx.gbl...
Hi, I have a class derived from ApplicationException as below (excuse
formatting):

[Serializable()]

public class MyException : ApplicationException {

public string CompanyName {

get {return Application.CompanyName;}

}

public string ProductName {

get {return Application.ProductName;}

}

public string ProductVersion {

get {return Application.ProductVersion;}

}

}

I am serializing it as follows:

IFormatter formatter = new SoapFormatter();

Stream stream = new FileStream(dlgSave.FileName, FileMode.Create,
FileAccess.Write, FileShare.None);

formatter.Serialize(stream, _ex);

stream.Close();

However, the extra properites I have added to the class are not getting
output. How come?

Thanks.

Nov 11 '05 #2

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

Similar topics

2
by: Jarda | last post by:
Hi all, i'm looking for some performance comparison some charts. I have read the xmlserializer is better, more flexible and faster (analyzing data types in constructor), but there are some...
2
by: Paul | last post by:
We currently persist our objects to xml/soap files using a SoapFormatter. We control the serialization and de-serialization by implementing the ISerializable and its two interface methods, namely,...
1
by: Jim S | last post by:
I have an application where I have to make a tree of objects. To do this, I have my own node class. At certain points in the application, I need to save data. I am having a problem with the...
2
by: Phillip Galey | last post by:
I have an object called Place which contains only string properties and has the <Serializable()> flag before the class name declaration. I also have a collection object called Places, which is...
0
by: seckley | last post by:
Hi i'm working on a project for school, i have created a serializable class that handles a person's name and address. i am using the collection class to handle the data. i then have to use a...
0
by: JackRazz | last post by:
I'm trying to serialize a collection to a file stream by serializing each object individually. The code below works fine with the BinaryFormatter, but the SoapFormatter reads the first object and...
0
by: GrandpaB | last post by:
I have an error that I have not been able to find. Any insight you can offer would be most appreciated. I believe that the problem is associated with the SoapFormatter. The application allows...
4
by: laplas | last post by:
Hello, what is the internal difference between them in FW 2.0? I'm trying to serialize SqlConnectionInfo from SQL SMO and Soap works just fine but XML throws an exception SqlConnectionInfo has...
5
by: =?Utf-8?B?TWFydHluIEZld3RyZWxs?= | last post by:
Hi there. I posted an earlier issue under the name "That assembly does not allow partially trusted callers" but have now identified what the issue is. As explained before I am working in...
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: 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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
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 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.