using System.Threading; class Program { static void Main(string[] args) { Barrier barrier = new Barrier(3); Thread thread1 = new Thread(() => { barrier.SignalAndWait(); Console.WriteLine("Thread 1"); }); Thread thread2 = new Thread(() => { barrier.SignalAndWait(); Console.WriteLine("Thread 2"); }); Thread thread3 = new Thread(() => { barrier.SignalAndWait(); Console.WriteLine("Thread 3"); }); thread1.Start(); thread2.Start(); thread3.Start(); barrier.SignalAndWait(); barrier.Dispose(); } }In the above code example, the Barrier object is created with a count of 3. Three threads are started and await at the Barrier checkpoint. Once all three threads reach the checkpoint, they continue execution and display a message. Afterwards, the Barrier object is disposed. Package Library: The Barrier Dispose method is part of the System.Threading class library.