내 스레드를 백그라운드 스레드로 구성하려고합니다. 스레드에서이 속성이 누락 된 이유는 무엇입니까?C# 배경 스레드 속성이 누락되었습니다.
Thread thread = new Thread(openAdapterForStatistics(_device));
하지만 내가 가지고 2 컴파일 오류 :
- System.Threading.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); } }
내가 시도가 .Threading.ThreadStart) '에 잘못된 인수가 있습니다.
- 인수 1 :'void '에서'System.Threading.ThreadStar '로 변환 할 수 없습니다. t '
및 배경 일에 대해
매개 변수가있는 함수에 대한 대리자를 전달해야하기 때문이라고 생각합니다. 기능이 아닙니다. 당신의 경우 초보자. – Juvil
'Thread thread = new Thread (() => openAdapterForStatistics (_device)); ' –