未定义路径i变量c#visualstudio



我找不到变量中未定义路径的位置。调试时,我会在表达式中看到路径名。

我该如何更改?

这是我代码的一部分:

private static string getPDFfilename(document theDoc)
        {
           string fullPathFilename = theDoc.MultiPagePdfFile;
            string filenameWithoutPath = Path.GetFileName(fullPathFilename);
            return filenameWithoutPath;

        }

        private static byte[] getEmbbeddedObj(document theDoc)
        {
                string filenameWithoutPath = theDoc.MultiPagePdfFile;
                byte[] bytes = File.ReadAllBytes(filenameWithoutPath);

                return bytes;
       }

错误

Doc.MultiPagePdfFile="E:\Ephesoft\final drop folder\Decoline\BI1450\LINDER SA_86846_DOC1.pdf"

filenameWithoutPath="E:\Ephesoft\final drop folder\Decoline\BI1450\LINDER SA_86846_DOC1.pdf"

基于变量名"filenameWithoutPath",您可以使用没有路径的文件名。如果为true,请在System.IO命名空间中使用FileInfo。

相关内容

最新更新