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

Best way to serialize an object to a String

Hi all!

has anyone an idea how to serialize an object to a String without using
XMLSerializer? The problem is, that i have to serialize a Hashtable to a
String and the XMLSerializer doesn't accept any object that inherits
from ICollection. So I have to use the Binary or SoapFormater. But both
accept only a Stream and .net has no StringStream.

Thanx!

Greetings
Pat
Jul 21 '08 #1
2 1486
Patrick Sona schrieb:
Hi all!

has anyone an idea how to serialize an object to a String without using
XMLSerializer? The problem is, that i have to serialize a Hashtable to a
String and the XMLSerializer doesn't accept any object that inherits
from ICollection. So I have to use the Binary or SoapFormater. But both
accept only a Stream and .net has no StringStream.

Thanx!

Greetings
Pat
I have found the solution by my self. The best way to serialize to a
String is using the MemoryStream, from which you can get a Bytearray.
This could be converted to a String!

Greetings
Pat
Jul 21 '08 #2

Take a peak here
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!114.entry
about
XmlSerialization with IDictionary and CollectionBase Objects
including a Hashtable.

"Patrick Sona" <so**@Flexsecure.dewrote in message
news:uN**************@TK2MSFTNGP06.phx.gbl...
Hi all!

has anyone an idea how to serialize an object to a String without using
XMLSerializer? The problem is, that i have to serialize a Hashtable to a
String and the XMLSerializer doesn't accept any object that inherits from
ICollection. So I have to use the Binary or SoapFormater. But both accept
only a Stream and .net has no StringStream.

Thanx!

Greetings
Pat

Jul 21 '08 #3

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

Similar topics

14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
10
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
2
by: films | last post by:
I understand the concept. Serialization of a class will add all the sub-objects of the class to the stream if there are also serializible. So say I have: class Author {
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
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...
6
by: Val | last post by:
How can I serialize/deserialize an object into a string. Existing examples seem to be showing this operation for files only. Thansk
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...
4
by: Brian | last post by:
HI, I have two sets of data, the largest set of data contains 370 rows... both sets only have two columns. I want to be able to distribute the data with my applaction. The other option, would be...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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.