Checking for the existence of a Table
// Must be called within QueuedTask.Run9)
public bool TableExists(Geodatabase geodatabase, string tableName)
{
try
{
TableDefinition tableDefinition = geodatabase.GetDefinition<TableDefinition>(tableName);
tableDefinition.Dispose();
return true;
}
catch
{
// GetDefinition throws an exception if the definition doesn't exist
return false;
}
}
Checking for the existence of a Feature Class
// Must be called within QueuedTask.Run()
public bool FeatureClassExists(Geodatabase geodatabase, string featureClassName)
{
try
{
FeatureClassDefinition featureClassDefinition = geodatabase.GetDefinition<FeatureClassDefinition>(featureClassName);
featureClassDefinition.Dispose();
return true;
}
catch
{
// GetDefinition throws an exception if the definition doesn't exist
return false;
}
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.