コード例 #1
0
 private static IEnumerable <MemoryTracker.ChildReference> GetAllReferencedClassesFromClassOrStruct(object current, IEnumerable <FieldInfo> fields, object parent, string currentPath)
 {
     foreach (FieldInfo field in fields)
     {
         if (!field.FieldType.IsPrimitive)
         {
             object referenced = null;
             referenced = field.GetValue(current);
             if (referenced != null)
             {
                 foreach (MemoryTracker.ChildReference child in MemoryTracker.DistillChildReferencesFromObject(referenced, parent, currentPath + field.Name))
                 {
                     yield return(child);
                 }
             }
         }
     }
     if (current != null && current is ICollection)
     {
         MemoryTracker.foundCollections.Add(new WeakReference(current));
         foreach (object entry in (current as IEnumerable))
         {
             if (entry != null && !entry.GetType().IsPrimitive)
             {
                 foreach (MemoryTracker.ChildReference child2 in MemoryTracker.DistillChildReferencesFromObject(entry, parent, currentPath + "[]"))
                 {
                     yield return(child2);
                 }
             }
         }
     }
 }
コード例 #2
0
        private static IEnumerable <ChildReference> GetAllReferencedClassesFromClassOrStruct(object current, IEnumerable <FieldInfo> fields, object parent, string currentPath)
        {
            foreach (FieldInfo field in fields)
            {
                if (!field.FieldType.IsPrimitive)
                {
                    object referenced = field.GetValue(current);
                    if (referenced != null)
                    {
                        using (IEnumerator <ChildReference> enumerator2 = MemoryTracker.DistillChildReferencesFromObject(referenced, parent, currentPath + field.Name).GetEnumerator())
                        {
                            if (enumerator2.MoveNext())
                            {
                                ChildReference child2 = enumerator2.Current;
                                yield return(child2);

                                /*Error: Unable to find new state assignment for yield return*/;
                            }
                        }
                    }
                }
            }
            if (current != null && current is ICollection)
            {
                MemoryTracker.foundCollections.Add(new WeakReference(current));
                IEnumerator enumerator3 = (current as IEnumerable).GetEnumerator();
                try
                {
                    while (enumerator3.MoveNext())
                    {
                        object entry = enumerator3.Current;
                        if (entry != null && !entry.GetType().IsPrimitive)
                        {
                            using (IEnumerator <ChildReference> enumerator4 = MemoryTracker.DistillChildReferencesFromObject(entry, parent, currentPath + "[]").GetEnumerator())
                            {
                                if (enumerator4.MoveNext())
                                {
                                    ChildReference child = enumerator4.Current;
                                    yield return(child);

                                    /*Error: Unable to find new state assignment for yield return*/;
                                }
                            }
                        }
                    }
                }
                finally
                {
                    IDisposable disposable;
                    IDisposable disposable2 = disposable = (enumerator3 as IDisposable);
                    if (disposable != null)
                    {
                        disposable2.Dispose();
                    }
                }
            }
            yield break;
IL_02f3:
            /*Error near IL_02f4: Unexpected return in MoveNext()*/;
        }
コード例 #3
0
 private static IEnumerable <MemoryTracker.ChildReference> GetAllReferencedClassesFromClassOrStruct(object current, IEnumerable <FieldInfo> fields, object parent, string currentPath)
 {
     foreach (FieldInfo field in fields)
     {
         if (!field.FieldType.IsPrimitive)
         {
             object referenced = null;
             referenced = field.GetValue(current);
             if (referenced != null)
             {
                 foreach (MemoryTracker.ChildReference child in MemoryTracker.DistillChildReferencesFromObject(referenced, parent, currentPath + field.Name))
                 {
                     yield return(child);
                 }
             }
         }
     }
     if (current != null && current is ICollection)
     {
         MemoryTracker.foundCollections.Add(new WeakReference(current));
         IEnumerator enumerator3 = (current as IEnumerable).GetEnumerator();
         try
         {
             while (enumerator3.MoveNext())
             {
                 object entry = enumerator3.Current;
                 if (entry != null && !entry.GetType().IsPrimitive)
                 {
                     foreach (MemoryTracker.ChildReference child2 in MemoryTracker.DistillChildReferencesFromObject(entry, parent, currentPath + "[]"))
                     {
                         yield return(child2);
                     }
                 }
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator3 as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
     }
     yield break;
 }