Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2004, 09:53 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stream Confusion

I've so far managed to avoid streams but now I am realy stuck.
I have a method (of a class I did not write) which returns either

System.Xml.XmlTextWriter OR
System.IO.Stream

I just want to put what is returned (some simple xml) into a string but after hours of trying and searching books and on line I am still unable to do this. I am sure this cannot be hard, Can anyone help please??
 
Old February 27th, 2004, 12:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

The 'Read' method of a stream object returns a byte array. You can then use the 'GetString' method of a suitable 'Encoding' class to convert that byte array into a string. The process is complicated a bit because the stream may have the bytes in it encoding in any number of character encoding formats, so you'll need to choose the one that's appropriate for your source.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
foreach confusion stokerfed C# 2 June 13th, 2007 02:30 PM
Class' Confusion dpkbahuguna Beginning VB 6 4 September 20th, 2006 11:16 PM
Some confusion in these code hpatel_it ASP.NET 1.0 and 1.1 Basics 0 August 30th, 2006 08:19 AM
Some confusion as to which SQL to use mark.uk SQL Server 2000 6 August 12th, 2004 10:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.