I need to retrieve the date modified for each feature class and raster in a file geodatabase. I have been able to accomplish this using the IDatasetFileStat interface for the feature classes using the methodology described here. However, I've been unable to find a raster class that implements the IDatasetFileStat. The documentation indicates that the RasterDataset should implement this interface but when I try to cast it, I get an InvalidCastException.
pGDS = BA_OpenRasterFromGDB(gdbPath, layerRasterList(i)) 'My custom function that opens a raster and returns IGeodataset
If pGDS IsNot Nothing Then
pRasterBandCollection = CType(pGDS, IRasterBandCollection) 'Explicit cast
pRasterBand = pRasterBandCollection.Item(0)
Dim myTest As RasterDataset = pRasterBand.RasterDataset
pDFS = CType(myTest, IDatasetFileStat) 'Invalid cast exception occurs here
Dim intSeconds As Integer = pDFS.StatTime(esriDatasetFileStatTimeMode.esriDatasetFileStatTimeLastModification)