Thread をバックグラウンド スレッドに設定したいのですが、このプロパティが Thread にないのはなぜですか?
ThreadStart starter = delegate { openAdapterForStatistics(_device); };
new Thread(starter).Start();
public void openAdapterForStatistics(PacketDevice selectedOutputDevice)
{
using (PacketCommunicator statCommunicator = selectedOutputDevice.Open(100, PacketDeviceOpenAttributes.Promiscuous, 1000)) //open the output adapter
{
statCommunicator.Mode = PacketCommunicatorMode.Statistics; //put the interface in statstics mode
statCommunicator.ReceiveStatistics(0, statisticsHandler);
}
}
私は試してみました:
Thread thread = new Thread(openAdapterForStatistics(_device));
しかし、私は2つのコンパイルエラーを持っています:
- 'System.Threading.Thread.Thread(System.Threading.ThreadStart)' に最も一致するオーバーロードされたメソッドには、無効な引数が含まれています
- 引数 1: 'void' から 'System.Threading.ThreadStart' に変換できません
そして、私は理由を知りません