C# .net core 相对路径转绝对路径 (官方示例)

 public static string GetAbsolutePath(string relativePath)
        {
            FileInfo _dataRoot = new FileInfo(typeof(Program).Assembly.Location);
            string assemblyFolderPath = _dataRoot.Directory.FullName;

            string fullPath = Path.Combine(assemblyFolderPath, relativePath);

            return fullPath;
        }

 

posted on 2019-08-15 14:13  马什么梅  阅读(2090)  评论(0编辑  收藏  举报

导航