Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

serialize to string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gusse.net - 07 Mar 2006 11:45 GMT
how can i serialize a class to a string ? i can write the data to a xml
file, but i would like to write to content into a string instead without
using a file...

I could write it to a xml file and from there into a string, but that would
not be the prefered method..

class test
{
       public name;
       public number;
}

Signature

gusse
www.gusse.net

johan.appelgren@gmail.com - 07 Mar 2006 14:40 GMT
How are you serializing your object? And can't you serialize to a
anything but a file?
johan.appelgren@gmail.com - 07 Mar 2006 14:56 GMT
How do you serialize it? Why can you only serialize to a file?
Chris Taylor - 07 Mar 2006 20:01 GMT
Hi,

Since you have not been very forth coming with information I will assume you
are referring to XmlSerializer.
If this is the case, you can pass the Serialize method an instance of a
StringWriter as the first argument, once the Serialize method returns you
can invoke ToString() on the StringWriter instance to get the Xml string.

Hope this helps

Signature

Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor

> how can i serialize a class to a string ? i can write the data to a xml
> file, but i would like to write to content into a string instead without
[quoted text clipped - 8 lines]
>        public number;
> }

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.