IWorkspaceFactory factory = new FileGDBWorkspaceFactoryClass();
Unable to cast object of type System.__ComObject to type ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass
Thank you Neil - you've helped me on and off for 20 years now!!
Yep! Thank you. this helped. But I still wonder most of my projects. this code won't break.
IWorkspaceFactory factory = new FileGDBWorkspaceFactoryClass();
But for my current project it breaks. And Neil Clemmons answer solves the problem.