Ifeaturelayer pflayer = mapmain. get_layer (0) as ifeaturelayer;
Ifeatureclass PFC = pflayer. featureclass;
// Edit is disabled due to incorrect type
If (PFC. shapetype! = ESRI. ArcGIS. Geometry. esrigeometrytype. esrigeometrypoint) {return ;}
// Create an editing Space
Idataset pdataset = PFC as idataset;
Iworkspace pworkspace = pdataset. workspace;
Iworkspaceedit pworkspaceedit = pworkspace as iworkspaceedit;
// start editing
pworkspaceedit. startediting (false );
pworkspaceedit. starteditoperation ();
// creation point
ESRI. arcGIS. geometry. ipoint point = new ESRI. arcGIS. geometry. pointclass ();
point. X = E. mapX;
point. y = E. mapy;
Ifeature pfeature = PFC. createfeature ();
Pfeature. Shape = point; // you can specify the new element as a point element.
// Set the attribute value for the element: pfeature. set_value (pfeature. Fields. findfield ("name"), name );
Pfeature. Store ();
// Stop editing
Pworkspaceedit. stopeditoperation ();
Pworkspaceedit. stopediting (true );
Mapmain. activeview. Refresh (); // new window