S
Steve
I am reworking a class that generates source code. I want to add a
"preview" function, much like the refactor dialog in vs2005. To facilitate
this, I have changed what used to be my "writeToFile" method to "generate" -
the plan is, I will generate the text in memory, then I can either show it
in a control or pass it to the method that does the file IO stuff.
I'm trying to determine the best class' to use for this, I was hoping there
was something that would let me build the string, then pass it to a writer
class, but I haven't found it yet. Currently I'm using StringWriter to
generate the source, then when I want to write the code, I use
StreamWriter.Write() passing it my StringWriter.ToString();
This seems ugly to me. Is there another way that would be cleaner? I was
hoping for something like setting a StreamWriter's internal data to my
StringWriter, or casting a StringWriter to a StreamWriter... something like
that. They seem so closely related.
Any ideas?
Thanks for reading,
Steve
"preview" function, much like the refactor dialog in vs2005. To facilitate
this, I have changed what used to be my "writeToFile" method to "generate" -
the plan is, I will generate the text in memory, then I can either show it
in a control or pass it to the method that does the file IO stuff.
I'm trying to determine the best class' to use for this, I was hoping there
was something that would let me build the string, then pass it to a writer
class, but I haven't found it yet. Currently I'm using StringWriter to
generate the source, then when I want to write the code, I use
StreamWriter.Write() passing it my StringWriter.ToString();
This seems ugly to me. Is there another way that would be cleaner? I was
hoping for something like setting a StreamWriter's internal data to my
StringWriter, or casting a StringWriter to a StreamWriter... something like
that. They seem so closely related.
Any ideas?
Thanks for reading,
Steve