好的,基本上这种情况正在发生:
我正在尝试运行
Thread tcpHandlerThread = new ParamaterizedThreadStart(tcpHandler);
但我收到了错误
类型或命名空间ParamaterizedThreadStart不存在
在ParamaterizedThreadStart上,但我有这些导入:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;
很抱歉,如果这是一个愚蠢的问题:\我缺少什么导入,或者只是我的Visual Studio出错?
答案 0 :(得分:0)
ParameterizedThreadStart
是delegate
。
请改用..
Thread tcpHandlerThread = new Thread(tcpHandler);
如果要运行带参数的方法。你可以用这个..
Thread tcpHandlerThread = new Thread(() => tcpHandler(parameters));
答案 1 :(得分:0)
看起来你拼错了ParameterizedThreadStart
类。
以下链接可能会对您有所帮助,并且有一个很好的示例,说明如何创建参数化线程。
https://msdn.microsoft.com/en-us/library/1h2f2459%28v=vs.110%29.aspx