Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我怎样才能通过考试;gdbFullName";来自公共类的字符串值;“萨利达”;“到字符串”;fcName";?_C#_Arcobjects - Fatal编程技术网

C# 我怎样才能通过考试;gdbFullName";来自公共类的字符串值;“萨利达”;“到字符串”;fcName";?

C# 我怎样才能通过考试;gdbFullName";来自公共类的字符串值;“萨利达”;“到字符串”;fcName";?,c#,arcobjects,C#,Arcobjects,我正在尝试为shp设置默认输出名称。文件为此,我要将gdbFullValue变量从公共类salida内部传递给字符串fcName,以便输出在最终名称中包含激活代码 我相信这与能手和二传手有关。但我已经尝试了一段时间,我无法理解我错过了什么 class Salida { ShapefileManage _shpManageOutput; IFeatureClass _outpuFc; public String _gdbName; public String

我正在尝试为shp设置默认输出名称。文件为此,我要将gdbFullValue变量从公共类salida内部传递给字符串fcName,以便输出在最终名称中包含激活代码

我相信这与能手和二传手有关。但我已经尝试了一段时间,我无法理解我错过了什么

   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; }
我得到的是一个NullReferenceValue,或者只是一个gdbFullName字符串,它是空的,因此最终的输出名称只包括fcName字符串的反静态部分


提前感谢

您正在尝试在设置gdbFullName之前从中提取激活码。 请注意,fcName是一个私有字段,在运行构造函数之前启动


为什么不将文件名的创建放在returnOutputName方法中?

谢谢您的建议。事实是,我不认为我已经展示了我必须在帖子中展示的东西:

公共类salida正在另一个类中实例化。因此,我所要做的就是将fcName设置为在实例化类时计算,而不是在外部。我把有效的代码留在这里

class Salida
{
    string _gdbName;
    ShapefileManage _shpManageOutput;
    IFeatureClass _outpuFc;
    //ISpatialReference spatialReference;


    public Salida(ShapefileManage shpManageOutput, ISpatialReference spatialReference, string gdbName)
    {
        this._gdbName = gdbName;
        this._shpManageOutput = shpManageOutput;
        crearCapaSalida(spatialReference, esriGeometryType.esriGeometryPoint);
    }
在另一个类中,可以找到主进程的地方是我用实际的fcName实例化salida类

// Instanciamos los objetos gdbManage and shpManage
            gdbManageInput = new GeodatabaseManage(_inputGdbPath);
            shpManageOutput = new ShapefileManage(_outputPath);

            // Instanciamos la clase salida, pasandole el spatialReference del dataset.
            IFeatureDataset fd = gdbManageInput.getFeatureDataset(_featureDataset);
            ISpatialReference spatialReference = (fd as IGeoDataset).SpatialReference;
            string gdbName = _inputGdbPath.Substring(_inputGdbPath.LastIndexOf('\\') + 1);
            string last14gdbName = gdbName.Substring(0, 14);
            string nombreSalida = "PositionalAccuracyPoints_" + last14gdbName;
            salida = new Salida(shpManageOutput, spatialReference, nombreSalida);

无论如何,非常感谢您的帮助,如果不是因为您的评论,我将无法确定自己的位置。

您在哪一行得到了例外?您确定要将gdbName传递给构造函数吗?如果您有其他问题,应该将它们放在OP的注释中。