I can't sort ou what is wrong with code in relation to error message "System.IO.StreamWriter.StreamWriter()' is inaccessible due to its protection level." Can someone help
using System;
using System.IO;
namespace Ab
{
public class Cab
{
StringWriter sw = new StringWriter();
private void UseSW()
{
sw.Writeline("please help");
}
}
}
Any tip would be very much appreciated. Thanks

With StreamWriter
Adam_Machanic
In your example, is StringWriter supposed to be StreamWriter as in:
StreamWriter sw = new StreamWriter();
If so, your problem is occurring because StreamWriter does not have any default accessors publicly accessible. There are several ways to create a StreamWriter object but the easiest is to simply pass it a filename upon creation like this:
StreamWriter sw = new StreamWriter("myFile.txt");
You can more info on the StreamWriter constructor objects here:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemiostreamwriterclassctortopic2.asp
Hope this helps :)
Jeremy
Doug Griffin
I can't see error - It works fine on my machine.
Try to reboot