ThinkGeo.com    |     Documentation    |     Premium Support

Access to FeatureSourceColumns

I want to access the collection that is found in myShapeFileFeatureLayer.FeatureSource.FeatureSourceColumns, but it is protected.


How does one get access to this collection?


I've invoked myShapeFileFeatureLayer.QueryTools.GetColumns(), however, that does not return the true underlying column definitions.


I'm looking for schema information where I have access to such properties as MaxLength and TypeName.


Thanks,


Dennis


 


 



Hi Dennis,


Thanks for your question!


I believe you can get this information using the following:



ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(MapPath("~/SampleData/world/cntry02.shp"));
worldLayer.FeatureSource.Open();
Collection<FeatureSourceColumn> columns = worldLayer.FeatureSource.GetColumns();
foreach (FeatureSourceColumn featureSourceColumn in columns)
      {
      Debug.WriteLine("Column Name: "+ featureSourceColumn.ColumnName.ToString() 
      + "  Type Name: " + featureSourceColumn.TypeName.ToString() + "  Max Length: " + featureSourceColumn.MaxLength);
      }


Thanks very much Ryan!  That is exactly what I was looking for.



Dennis,  
  
 Glad to hear that you found the solution. 
  
 Regards, 
 Edgar