Get Iwrokspace using IFeatureClass in ArcObject C3

By using this function you can get Iworkspace using IFeatureClass.

By using this function you can get Iworkspace using IFeatureClass.

public
IWorkspace getWorkSpace(IFeatureClass fetCls)
{
   IWorkspace res = null;
   try
   {
      IFeatureDataset pFeatDataSet = fetCls.FeatureDataset;
      IDataset pDataSet = pFeatDataSet as IDataset;
      res = pDataSet.Workspace;
   }
   catch (Exception ex)
   {
      return null;
   }
   return res;
}