public static NPC Find(this NetCollection <NPC> npcs, string name) { NPC npc; using (NetCollection <NPC> .Enumerator enumarator = npcs.GetEnumerator()) { while (true) { if (enumarator.MoveNext()) { NPC npc2 = enumarator.Current; if (npc2.Name != name) { continue; } npc = npc2; } else { return(null); } break; } } return(npc); }