我做错了List<void> voidList = new List<void>();.我怎么做那样的东西呢?
在我的班级"Server.cs"中,我想从表单中访问文本框.我尝试使用此代码:
ServerWindow.WriteChatlog(encoder.GetString(message, 0, bytesRead));
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误:
An object reference is required for the non-static field, method, or property 'Chat_Server.ServerWindow.WriteChatlog(string)
Run Code Online (Sandbox Code Playgroud)
ServerWindows.WriteChatlog(字符串文本)如下所示:
public void WriteChatlog(string text)
{
textBox1.Text += text + Environment.NewLine;
}
Run Code Online (Sandbox Code Playgroud)
现在我尝试直接从我使用ServerWindow.WriteChatlog方法的地方这样做,但它没有用.
它们都是非静态的