sb to text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

i was wondering how would i take the contents of my StrigBuilder variable
and out put all of it to my text file?

thanks,
rodchar
 
rodchar said:
i was wondering how would i take the contents of my StrigBuilder variable
and out put all of it to my text file?

\\\
Dim sw As New StreamWriter(...)
sw.Write(sb.ToString())
sw.Close()
///
 
Cor Ligthert said:
Dim sb As New System.Text.StringBuilder
Dim a As String = sb.ToString

Remember what the OP asked:

| i was wondering how would i take the contents of
| my StrigBuilder variable and out put all of it to my text file?
 
Herfried,

It is not that important that we build such a long thread from it, I noticid
it, and thought about your messages you have written, where you told that
you did not like those everywhere needed () in C#

And see in the sb.tostring is that not really needed, that was all.
Maybe should I have added a :-)
Dim sw As New IO.StreamWriter("bla")

Dim sb As New System.Text.StringBuilder

sw.Write(sb.ToString)

sw.Close()

Cor
 
Cor,
sw.Write(sb.ToString)
Appears to be a Property call, hence I normally use:
sw.Write(sb.ToString())
To emphasis that it is a Function call!

Granted the VB compiler does care either way, so its largely a style thing.

Like Herfried I really question what this has to do with C#???

Just a thought
Jay
 
Jay,

Nothing this thread is already much to long,
It was only that I saw that Herfried had written ToString() what I am not
used from him.

:-)

Cor
 
Cor,

Cor Ligthert said:
it, and thought about your messages you have written, where you told that
you did not like those everywhere needed () in C#

And see in the sb.tostring is that not really needed, that was all.
Maybe should I have added a :-)
Dim sw As New IO.StreamWriter("bla")

Dim sb As New System.Text.StringBuilder

sw.Write(sb.ToString)

sw.Close()

I always add '()' to calls to parameterless functions to distinguish them
from property "calls". I don't see how this would make my code look more
C#ish.
 
Cor said:
Jay,

Nothing this thread is already much to long,
It was only that I saw that Herfried had written ToString() what I am not
used from him.

:-)

Cor


Are you two secretly an old married couple? ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

form image 4
reading a text file 1
array bound listbox 2
2 arrays into 1 2
comparing text files 6
form's backgroundimage 7
string formatting 5
whu do u do 5

Back
Top