public IProfilingTarget this[Guid uid]
 {
     get
     {
         lock (_collection)
         {
             VerifyDisposed();
             ProfilingTarget profilingTarget;
             if (_collection.TryGetValue(uid, out profilingTarget))
             {
                 return(profilingTarget);
             }
             IProfilingTarget remoteProfilingTarget = Execute(() => RemoteObject[uid]);
             profilingTarget = new ProfilingTarget(remoteProfilingTarget);
             _collection.Add(uid, profilingTarget);
             return(profilingTarget);
         }
     }
 }
 public bool TryGet(Guid uid, out IProfilingTarget item)
 {
     lock (_collection)
     {
         ProfilingTarget profilingTarget;
         if (_collection.TryGetValue(uid, out profilingTarget))
         {
             item = profilingTarget;
             return(true);
         }
         IProfilingTarget remoteProfilingTarget = null;
         if (Execute(() => RemoteObject.TryGet(uid, out remoteProfilingTarget)))
         {
             profilingTarget = new ProfilingTarget(remoteProfilingTarget);
             _collection.Add(uid, profilingTarget);
             item = profilingTarget;
             return(true);
         }
     }
     item = null;
     return(false);
 }
        private void Initialize()
        {
            if (_initialized)
            {
                return;
            }
            List <IProfilingTarget> remoteProfilingTargets = Execute(() => RemoteObject.ToList());

            if (remoteProfilingTargets.Count == _collection.Count)
            {
                return;
            }
            foreach (IProfilingTarget remoteProfilingTarget in remoteProfilingTargets)
            {
                ProfilingTarget profilingTarget = new ProfilingTarget(remoteProfilingTarget);
                if (!_collection.ContainsKey(profilingTarget.Definition.Uid))
                {
                    _collection.Add(profilingTarget.Definition.Uid, profilingTarget);
                }
            }
            _initialized = true;
        }