streamwriter

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

Guest

Can one streamwriter object create dynamic files? in nested if statement?
example of code
 
Hi CJ,

What do you mean by dynamic files?
Having a StreamWriter reference you can certainly change it any time you want.

StreamWriter sw;

if(condition1)
sw = new StreamWriter(param1);
else if(condition2)
sw = new StreamWriter(param2);
else
sw = new StreamWriter(param3);
 
CJ said:
Can one streamwriter object create dynamic files? in nested if statement?
example of code

It would help if you could explain what you meant by "dynamic files".
 
CJ,

If you get a read only error, then your parameter is either incorrect, the file is used by another program or another file handle in your own program.
If you reuse a StreamWriter remember to call Close() on it to release the current file before you use it on another file.
 

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

Back
Top