I am using StreamWriter to debug a stock trading program and my code creates the file, but will not write to it. I am sure I am missing something simple. I know the method is being used because the D() command you see writes to a debug window. I am not sure what I am missing but the file is created, but always empty.
public class SterlingDebug : ResponseTemplate
{
StreamWriter writer = new StreamWriter(@"C:\Documents and Settings\ecoarsey\SterlingIssue10222010.txt");
int i = 0;
public override void GotTick(Tick tick)
{
i++;
if (i < 11)
{
D(tick.ToString());
writer.WriteLine("Tick #: {0}",i);
}
}
}