string wallIdString = "12345"; ElementId wallElementId = new ElementId(wallIdString.AsElementId());
string doorIdString = "9876"; FamilyInstance doorInstance = new FilteredElementCollector(doc) .OfClass(typeof(FamilyInstance)) .Where(x => x.Id == doorIdString.AsElementId()) .FirstOrDefault();This example shows how to use the AsElementId method to filter out a specific door instance from all the FamilyInstance elements present in a document with ID matching that of the string ID provided. It is assumed that the Autodesk.Revit.DB package library is being used.