Home
Manage Your Code
Snippet: Get a Selected Feature (C#)
Title: Get a Selected Feature Language: C#
Description: Sample for finding the (first) selected feature Views: 288
Author: Hans Bampel Date Added: 10/22/2007
Copy Code  
1	private IFeature GetSelectedFeature()
2	{
3		IActiveView activeView = ..;
4		ISelection selection = activeView.Selection;
5		IFeature feature = GetSelectedFeature(selection);
6		return feature;
7	}
8
9	private static IFeature GetSelectedFeature(ISelection selection)
10	{
11		IEnumFeature enumFeature = selection as IEnumFeature;
12		if (enumFeature == null)
13			return null;
14		else
15		{
16			enumFeature.Reset();
17			return enumFeature.Next();
18		}
19	}