Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir May I Know That

I have .cs file named Calculation.cs and i want to hold this file in StringBuilder. Is It Possible ?
Posted
Comments
Sushil Mate 17-Jul-13 7:30am    
why you want to do that?
Anjanee Kumar Singh 18-Jul-13 1:02am    
Sir i am just asking .....
[no name] 17-Jul-13 7:34am    
If you mean can you read the file and store the contents in a string builder, then the answer is yes.
Jean A Brandelero 17-Jul-13 7:44am    
I sent a sample code, but, let us know... Why you want to do this?
Anjanee Kumar Singh 18-Jul-13 1:02am    
Sir i am just asking .....

Yes, it is possible. You may hold the file content into a StringBuilder object. However does it make sense?
 
Share this answer
 
v2
Comments
Anjanee Kumar Singh 18-Jul-13 1:04am    
Ofcourse It Doesn't make any Sense...

i am just asking ....
C#
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (var item in System.IO.File.ReadAllLines(PathToCalculationCS))
{
     sb.AppendLine(item);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900