Example #1
0
        private void SwitchContext(ScriptContext ctxt, bool isAssigning)
        {
            if (ctxt == null) return;

              if (isAssigning)
              {
            ctxt.SetOwner(this);
              }
              else
              {
            var refs = _referenceCache.ToArray();
            foreach (var r in refs) r.Remove();

            //Verify all references were cleared
            Diagnostics.Assumes.IsTrue(_referenceCache.Count == 0);

            ctxt.SetOwner(null);
              }
        }