Ejemplo n.º 1
0
 public static void AlsoNeedHelp()
 {
     using (RwLck lck = TheVault.Lock())
     {
         IllegalWrapper wrapper = default;
         wrapper.SetLockedResource(in lck);
         lck.AppendLine("Goodbye cruel world!");
         Console.WriteLine(wrapper.WrappedLockedResource.ToString());
     }
 }
Ejemplo n.º 2
0
        public static void HelpMe()
        {
            using RwLck lck = TheVault.Lock();

            //bad
            IllegalWrapper wrapper = IllegalWrapper.CreateCopyInSneakyWay(in lck, DateTime.Now);

            //also bad
            wrapper.SetLockedResource(in lck);

            lck.AppendLine("Hi mom!");

            Console.WriteLine(wrapper.WrappedLockedResource.ToString());
        }