|
-
Feb 12th, 2009, 07:30 AM
#1
Thread Starter
Addicted Member
[2005] Stringbuilder & level declaration
Hi all,
I was wondering something. Is it a good idea to declare a StringBuilder object as a class level variable?
For instance, I have a variable called CLogText that is declared at the class level. I use this object to build error messages each time an exception is thrown, and write it to a log.
I know I can keep appending text to it, but I want each exception entry to be separate.
The way I was thinking of doing it would be to keep the class level declaration, but just clear the buffer each time I write an exception like so:
Code:
ClogText.Replace(ClogText.ToString, " ")
I'd really like to avoid declaring a new StringBuilder in each procedure. Just trying to make as many reuseable objects as I can.
Mods, I didn't know exactly what forum this fit into. I just put it in here because it's a web application.
If my post helped you, please rate it!
Languages: VB/ASP.NET 2005, C# 2008,VB6
Databases: Oracle (knowledge not currently in use), DB2
FROM Customers
WHERE We_Know_What_We_Want <> DB.Null
SELECT *
0 rows returned
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|