Q:

Why do I need to use locks with semaphore

I want to create Queue while defining max size with semaphore.
Enque will add item and deque will delete item
public void Enque(T item)
    {
        semaphore.WaitOne();
        privateQueue.Enqueue(item);

While googling similar situations I found out that sometimes locks are used 
like this
semaphore.WaitOne();
lock(lock)
privateQueue.Enqueue(item);

Why do we need to add locks with semaphore?
Thanks

A:

If your semaphore allows concurrent access to the queue (by allowing a maximum count > 1), then enqueuing and dequeuing must be done in a thread-safe manner.
Alternatively, you could use a queue that's already thread-safe, such as ConcurrentQueue<T>, and then you wouldn't need a lock - provided that the lock only protected the queue itself. If the lock encompassed more than that (it's hard to say from the code snippet in your question) then you may need it anyway.

