public static int GetGeneration(WeakReference wo) { int generationWr = GC.GetGenerationWR(wo.m_handle); GC.KeepAlive((object)wo); return(generationWr); }