I have a problem. When I run my program, it comes up with an error, specifically the CS1023 error. I guess it's because I have a declaration inside a statement, but I don't know how else to write the code. Sometimes C# annoys me, because in C++ I could get away with similar things... anyway, here's the code. I would appreciate it if somebody could explain it to me. Error Message Link
void BtnTotalSeasonsClick(object sender, EventArgs e)
{
using (var stream = new FileStream(drvFile, FileMode.Open, FileAccess.ReadWrite))
Byte[] bytes = System.Text.ASCIIEncoding.GetBytes(txtTotalSeasons.Text);
{
stream.Position = 4;
Stream.WriteByte(0xCD);
}
}
Fixed Code with CS0120 error.
{
using (var stream = new FileStream(drvFile, FileMode.Open, FileAccess.ReadWrite))
{
Byte[] bytes = System.Text.ASCIIEncoding.GetBytes(txtTotalSeasons.Text);
stream.Position = 4;
Stream.WriteByte(0xCD);
}
}