I am trying to set a default output name for a shp. file. For this I am to pass the gdbFullValue variable from inside the public class salida to the String fcName so that the output includes the activation code in the final name.
I believe it has to do with getters and setters. But I have been trying around for some time and I am not able to understand what I am missing.
class Salida
{
ShapefileManage _shpManageOutput;
IFeatureClass _outpuFc;
public String _gdbName;
public String gdbFullName;
public Salida(ShapefileManage shpManageOutput, ISpatialReference spatialReference, String gdbName)
{
this._shpManageOutput = shpManageOutput;
this.crearCapaSalida(spatialReference, esriGeometryType.esriGeometryPoint);
this._gdbName = gdbName;
string gdbFullName = gdbName.Substring(gdbName.LastIndexOf("/") + 1);
}
private string fcName = string.Format("PositionalAccuracySamplePoints" + "_" + "{0}", gdbFullName.Substring(0, 14));
public string returnOutputName()
{ return fcName; }
What I am getting is a NullReferenceValue or simply a gdbFullName string that is empty and therefore the final output name only includes de static part of the fcName string.
Thanks in advance
You are trying to extract the activation code from gdbFullName before it is set. Note that fcName is a private field which is initiated before your constructor is run.
Why don't you put the creation of the filename into your returnOutputName method?