DDW

.get_Field has error

Discussion created by DDW on Oct 18, 2011
Latest reply on Oct 19, 2011 by DDW
Relatively new to ArcObjects and C# programing and I am having an error appear on the field = fields.get_Fields(fieldIndex); line. Can someone let me know what step I am missing? Am I missing a Reference? Up until the last line the code works.

string layerDirectory = @"M:\taxlots";
string layerFile = "parcels";
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactoryClass();
IWorkspace workspace = workspaceFactory.OpenFromFile(layerDirectory, 0);
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(layerFile);
int fieldIndex = parcelTable.FindField("ASSESSOR_N");
IField fields = (IField)featureClass.Fields;
IField field = null;
field = fields.get_Field(fieldIndex);

Thanks

Outcomes