Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

stringstream in C#?

1,344 views
Skip to first unread message

edmund

unread,
Sep 17, 2002, 5:06:05 AM9/17/02
to
Is there a stl stringstream like type in C# or FCL? So one can have code
like this:

stringstream s;
s << myString << myInt << ...;

instead of

StringBuilder s;
s.Append(myString);
s.Append(myInt);
// ... a lot of Appends

Jon Skeet

unread,
Sep 17, 2002, 5:23:30 AM9/17/02
to

No, but you can use String.Format to do a lot of that for you if you
want - and for individual strings you can always use +.

--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Christian Graus

unread,
Sep 16, 2002, 5:46:44 PM9/16/02
to

SAdly, no. C# has equivalents of the more ugly C style formatting
instead. Many very lovely things in C++ are missing in C#, probably
because the C# developers were ignorant of them. The absence of
templates also makes for an ugly world, especially when it come to
containers, but I'm sure you already found that out for yourself...

Christian

Günther Makulik

unread,
Sep 17, 2002, 5:44:05 AM9/17/02
to
At least if you prefer the STL like syntax, you could easily write your own
class supporting the appropriate operator methods.

HTH

--
Günther Makulik
Senior Developer
Sangat-Systems AG (http://www.sangat-systems.de/default_en.html)

"Jon Skeet" <sk...@pobox.com> wrote in message
news:MPG.17f104eca...@msnews.microsoft.com...

Jeremy Kothe

unread,
Sep 17, 2002, 6:08:33 AM9/17/02
to
Hi Christian,

> SAdly, no. C# has equivalents of the more ugly C style formatting
> instead. Many very lovely things in C++ are missing in C#, probably

> because the C# developers were ignorant of them. ...

I *don't* think that this is the case. Check out the resumes of the guys
involved.

> ... The absence of


> templates also makes for an ugly world, especially when it come to
> containers, but I'm sure you already found that out for yourself...

Which will, it seems, be addressed in a future release... Although I've
found that the object heirarchy and boxing remove most of the ugliness -
what they leave is runtime type-checking and performance hits due to boxing.

Arild Fines

unread,
Sep 17, 2002, 9:51:09 AM9/17/02
to
Günther Makulik wrote:
> At least if you prefer the STL like syntax, you could easily write
> your own class supporting the appropriate operator methods.

No, you cant use operators as statements like you can in C++. An overloaded
operator will only be usable in an expression.

--
Arild Fines


0 new messages