Dear John,
Thank you for your query.
If you would like to try Christian's friendly and helpful suggestion, you might like to try this one as well:
ICollection<ElementId> ids = new FilteredElementCollector( doc ) .OfClass( typeof( Family ) ) .ToElementIds();
Christian, might be a useful addition to your toolbox as well :-)
I hope this helps.
Best regards,
Jeremy