Monitor and lock is the way to provide thread safety in a multithreaded application in C#. Both provide a mechanism to ensure that only one thread is executing code at the same time to avoid any functional breaking of code. Lock is the keyword in C# that will ensure one thread is executing a piece of code at one time.