Beispiel #1
0
 /// <summary>
 /// Removes a weak reference to an instance from the instances list.
 /// </summary>
 /// <param name="instance">An instance of <see cref="ImageListManager"/>.</param>
 private static void RemoveInstance(ImageListManager instance)
 {
     for (int i = 0, length = instances.Count; i < length; i++)
     {
         var imageListManager = instances[i].Target as ImageListManager;
         if (imageListManager == null)
         {
             instances.RemoveAt(i--);
             length--;
         }
         else if (imageListManager == instance)
         {
             instances.RemoveAt(i);
             break;
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Adds a weak reference of an instance to the <see cref="instances"/> list.
 /// </summary>
 /// <param name="instance">An instance of <see cref="ImageListManager"/>.</param>
 private static void AddInstance(ImageListManager instance)
 {
     instances.Add(new WeakReference(instance));
 }