Repository for Ideas & Research
Open Source GIS, Hydrologic Modeling, Optimization

How to create a new feature layer using ArcObjects

IApplication app;
IMxDocument mxDoc;
IMap map;
IFeatureLayer fl;

// get the handle of the focus map
app = ArcMap.Application;
mxDoc = (IMxDocument)app.Document;
map = mxDoc.FocusMap;

// create a feature layer
fl = new FeatureLayerClass();
fl.Name = yourFeatureClass.AliasName;
fl.FeatureClass = yourFeatureClass;

// add the feature layer to the focus map
map.AddLayer(fl);