Ted Miller
11/3/2003 9:52:00 PM
Thanks for the reply.
Yes, a "higher order" stream might help -- but this particular class deals
in plain IO.Stream objects -- preserving the ability of the caller to use a
FileStream or a MemoryStream or...
I am in fact currently using System.Buffer to get the data out into a byte
array for this.
My point was that it seems kinda broken to have to all this copying just to
get around the type system.
Thanks again though!
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@email.msn.com> wrote in message
news:OXvNASkoDHA.2512@TK2MSFTNGP09.phx.gbl...
> Ted,
> Rather then use a System.IO.Stream directly have you looked at using a
> System.IO.StreamWriter or a System.IO.BinaryWriter.
>
> As the higher order Writer objects accept higher order objects an properly
> convert/encode them for the underlying stream.
>
> Note you may still need to iterate over your array and writer out each
array
> element.
>
> The System.Buffer class is useful to take an array of ints or uints & copy
> to an array of bytes.
>
> Hope this helps
> Jay
>
> "Ted Miller" <ted@nwlink.com> wrote in message
> news:vqcjnmigknr181@corp.supernews.com...
> > So I've got a class that wants to write out an array of uints to a
Stream.
> > It seems that in the most general case I am forced to copy my uint[]
into
> a
> > byte[] just so I can call Stream.Write. If there was an overload of
> > Stream.Write that took a System.Array, an index, and a count, this would
> be
> > trivially simple.
> >
> > Or am I just overlooking something obvious?
> >
> >
>
>