There is an example here using the go client but it could easily be adapted to the C# client. You will need to decide on a data store to store the lock and create an implementation of the C# client's ILock interface. For my case I am considering using this DistributedLock package but I haven't implemented it yet.