TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Suraj Kumar
NA
9.9k
2.2m
ThreadPool.QueueUserWorkItem is not working in C# Console
Jun 1 2019 2:27 AM
I am trying to use ThreadPool in C# Console application as shown below.
static
void
Main(
string
[] args)
{
for
(var i = 1; i<= 10; i++)
{
ThreadPool.QueueUserWorkItem(n =>
{
Console.WriteLine($
"Start operation {n}"
);
Thread.Sleep(1000);
// Simulate long running operation
Console.WriteLine($
"Operation {n} completed"
);
}, i);
}
Console.ReadKey();
}
But it is showing the below error:
The type or namespace name "
QueueUserWorkItem
" does not exist in the namespace "ThreadPool".
What I am doing wrong or which reference I need to add. I have already used the namespace system.Threading.
I am working on .Net framework version 4.6.
Reply
Answers (
1
)
StackExchange.Redis Cache
Getting the row value from shapefile to featureclass(Arcobj)