首先as是类型转换的意思,是引用类型的显示转换,一楼说的很详细了。
ILayer、IFeatureLayer、IFeatureClass 、IFeatureCursor都不是普通类,你见过类前面有I吗??呵呵,这些都是接口,把msdn上ILayer的介绍你看下:
Provides access to members that work with all layers. Note: the ILayer interface has been superseded by ILayer2. Please consider using the more recent version.
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Description
ILayer is a generic interface for all layer objects. This interface has a method to draw the layer and provides access to generic layer properties.
建议多看看msdn吧。
这几句话的意思,楼上说的也都差不多了,我就不补充了。
pLayer as IFeatureLayer
这其实是VB过来的语法,表示强制转换
相当于(IFeatureLayer)pLayer
将pLayer强制转换为IFeatureLayer
因为在打开远程数据时必须使用IFeatureLayer
-----------------------------------------------------------
private AxMapControl m_MapCtl;
//这句不用解释吧
ILayer pLayer=m_MapCtl.get_Layer(0);
//获得这个控件中的第0个图层
IFeatureLayer pFLayer=pLayer as IFeatureLayer;//as 起到什么作用?
//已经解释
IFeatureClass pFC = pFLayer.FeatureClass;
//将图层转换成要素类,为后来的数据过滤做准备
IFeatureCursor pFCursor = pFC.Search(null, false);
//这个应该是过滤作用的
//我说的专业术语可能不准确,但是意思是这个意思
as是类型转换,如果转换失败不会报错,会返回null
你说的这几个类都是自定义的吧.具体情况等待知情者回答了.