string filePath =@"E:/Randy0528/中文目录/JustTest.rar";

更改路径字符串的扩展名。
System.IO.Path.ChangeExtension(filePath, "txt");
E:/Randy0528/中文目录/JustTest.txt

返回指定路径字符串的目录信息。
System.IO.Path.GetDirectoryName(filePath);
E:/Randy0528/中文目录

返回指定的路径字符串的扩展名。
System.IO.Path.GetExtension(filePath);
.rar

返回指定路径字符串的文件名和扩展名。
System.IO.Path.GetFileName(filePath);
JustTest.rar

返回不具有扩展名的指定路径字符串的文件名。
System.IO.Path.GetFileNameWithoutExtension(filePath);
JustTest

获取指定路径的根目录信息。
System.IO.Path.GetPathRoot(filePath);
E:/

返回随机文件夹名或文件名。
System.IO.Path.GetRandomFileName();
ct2h5b2h.sed

创建磁盘上唯一命名的零字节的临时文件并返回该文件的完整路径。
System.IO.Path.GetTempFileName();
C:/Documents and Settings/Randy/Local Settings/Temp/tmpAD.tmp

返回当前系统的临时文件夹的路径。
System.IO.Path.GetTempPath();
C:/Documents and Settings/Randy/Local Settings/Temp/

确定路径是否包括文件扩展名。
System.IO.Path.HasExtension(filePath);
True

获取一个值,该值指示指定的路径字符串是包含绝对路径信息还是包含相对路径信息。
System.IO.Path.IsPathRooted(filePath);
True

IO.Path路径的更多相关文章

  1. System.IO.Path文件路径类

    Path类的静态属性和方法,此类操作不影响物料文件. 属性 char a = System.IO.Path.VolumeSeparatorChar;//: char b = System.IO.Pat ...

  2. C#使用System.IO.Path获取文件路径、文件名

    class Program { static void Main(string[] args) { //获取当前运行程序的目录 string fileDir = Environment.Current ...

  3. [原]System.IO.Path.Combine 路径合并

    使用 ILSpy 工具查看了 System.IO.Path 类中的 Combine 方法 对它的功能有点不放心,原方法实现如下: // System.IO.Path /// <summary&g ...

  4. System.IO.Path 文件名、路径、扩展名 处理

    string filePath =@"E:/Randy0528/中文目录/JustTest.rar"; 更改路径字符串的扩展名.System.IO.Path.ChangeExten ...

  5. System.IO.Path 文件名、路径、扩展名处理

    string filePath =@"E:/Randy0528/中文目录/JustTest.rar"; 更改路径字符串的扩展名.System.IO.Path.ChangeExten ...

  6. 【C# IO 操作】 Path 路径类 |Directory类 |DirectoryInfo 类|DriveInfo类|File类|FileInfo类|FileStream类

    Directory类 Directory类 是一个静态类,常用的地方为创建目录和目录管理. 一下来看看它提供的操作. 1.CreateDirectory 根据指定路径创建目录.有重载,允许一次过创建多 ...

  7. C#、.Net代码精简优化(空操作符(??)、as、string.IsNullOrEmpty() 、 string.IsNullOrWhiteSpace()、string.Equals()、System.IO.Path 的用法)

    一.空操作符(??)在程序中经常会遇到对字符串或是对象判断null的操作,如果为null则给空值或是一个指定的值.通常我们会这样来处理: .string name = value; if (name ...

  8. WPF 打印崩溃问题( 异常:Illegal characters in path/路径中有非法字符)

    现象: 打印时候程序直接崩溃.调试时出现下列异常. 异常信息: 中文:System.ArgumentException : 路径中有非法字符. 英文: System.ArgumentException ...

  9. 使用System.IO.Combine(string path1, string path2, string path3)四个参数的重载函数提示`System.IO.Path.Combine(string, string, string, string)' is inaccessible due to its protection level

    今天用Unity5.5.1开发提取Assets目录的模块,使用时采用System.IO.Path.Combine(string, string, string, string)函数进行路径生成 明明是 ...

随机推荐

  1. Winform ComBox模糊查询

    一.添加数据源并绑定 List<string> list = new List<string>(); list.Add("张三"); list.Add(&q ...

  2. 【android错误】bitmap size exceeds 32bits

    使用图片缩放时遇到这么个问题: java.lang.IllegalArgumentException: bitmap size exceeds 32bits 后来一行行查代码,发现原来是 scale ...

  3. XTU 1252 Defense Tower

    $2016$长城信息杯中国大学生程序设计竞赛中南邀请赛$J$题 贪心. 优先删除$power$大的点. #pragma comment(linker, "/STACK:1024000000, ...

  4. Gentoo解决Windows系统txt文本中文乱码问题

    Linux与Windows系统语言编码区别 在Linux操作系统下,我们有时打开在windows下的txt文件,发现在windows下能正常显示的txt文件出现了中文乱码. 出现这种情况的原因为两种操 ...

  5. Meta标签中的format-detection属性及含义让IPHONE的数字可以改变颜色

    format-detection翻译成中文的意思是“格式检测”,顾名思义,它是用来检测html里的一些格式的,那关于meta的format-detection属性主要是有以下几个设置: meta na ...

  6. HTML中判断手机是否安装某APP,跳转或下载该应用

    有些时候在做前端输出的时候,需要和app的做些对接工作.就是在手机浏览器中下载某app时,能判断该用户是否安装了该应用.如果安装了该应用,就直接打开该应用:如果没有安装该应用,就下载该应用.那么下面就 ...

  7. js获取计算的样式(非行间样式)

    function getStyle(obj, attr){ if(obj.currentStyle){ style = obj.currentStyle[attr]; //兼容IE8以下 }else{ ...

  8. HDU 5839 Special Tetrahedron

    HDU 5839 Special Tetrahedron 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n ...

  9. iPhone doesn’t support any of GongShangJ.app’s architectures. You can add iPhone’s armv7s architectu

    iPhone doesn't support any of GongShangJ.app's architectures. You can add iPhone's armv7s architectu

  10. 非root用户搭建hadoop伪分布式

    0.安装软件列表 jdk-7u25-linux-x64.tar.gz hadoop-2.5.0.tar.gz hadoop-native-64-2.5.0.tar   1.准备Linux环境(root ...