// methods need to run on the MCT ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { try { // open a gdb using (ArcGIS.Core.Data.Geodatabase gdb = new ArcGIS.Core.Data.Geodatabase( new FileGeodatabaseConnectionPath(new Uri(@"c:\Temp\MyDatabase.gdb")))) { //Open a featureClass using (ArcGIS.Core.Data.FeatureClass featureClass = gdb.OpenDataset<ArcGIS.Core.Data.FeatureClass>("Polygon")) { ArcGIS.Core.Data.QueryFilter filter = new ArcGIS.Core.Data.QueryFilter() { WhereClause = "OBJECTID = 6" }; // get the row using (ArcGIS.Core.Data.RowCursor rowCursor = featureClass.Search(filter, false)) { while (rowCursor.MoveNext()) { using (var row = rowCursor.Current) { long oid = row.GetObjectID(); // get the shape from the row ArcGIS.Core.Data.Feature feature = row as ArcGIS.Core.Data.Feature; Polygon polygon = feature.GetShape() as Polygon; // do something here } } } } } } catch (Exception ex) { // error - handle appropriately } });
System.Object
ArcGIS.Core.Geometry.Geometry
ArcGIS.Core.Geometry.Envelope
ArcGIS.Core.Geometry.GeometryBag
ArcGIS.Core.Geometry.MapPoint
ArcGIS.Core.Geometry.Multipart
ArcGIS.Core.Geometry.Multipatch
ArcGIS.Core.Geometry.Multipoint
Target Platforms: Windows 11, Windows 10