C#控制台基础 path.combine合并多个字符串,返回一个路径

1 代码

 1 using System;
 2 using System.Collections.Generic;
 3 using System.IO;
 4 using System.Linq;
 5 using System.Text;
 6 using System.Threading.Tasks;
 7
 8 namespace ConsoleApplication4
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {                                                    //这个路径的最后一定要有一个\
14             string path = @"D:\用户目录\我的文档\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\";
15             string fileName = @"1.txt";
16             string full = Path.Combine(path, fileName);
17             Console.WriteLine(full);
18             Console.ReadKey();
19         }
20     }
21 }

2 效果

时间: 2024-08-07 09:27:25

C#控制台基础 path.combine合并多个字符串,返回一个路径的相关文章

C#控制台基础 path.changeextension一个路径字符串中的文件扩展名

将一个txt文件,改成exe 0.文件 1.代码 1 using System; 2 using System.Collections.Generic; 3 using System.IO; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace ConsoleApplication4 9 { 10 class Program 11 { 12 static void Main(

SqlSever基础 char函数 由ASCII码值返回一个字符

镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ 1 code 1 --已知一个字符的ASCII值,求他的字符 2 select char (97) 2 show ------------------------------------------博文的精髓,在技术部分,更在镇场一诗.SqlSever是优秀的语言,值得努力学习.熟悉数据库的增删查

让所有用户的PATH环境变量的值多出一个路径,例如/usr/local/apache/bin

一编辑配置文件 vim ~/.bash_profile 二/生效文件 source 或者. ~/.bash_profile 原文地址:https://www.cnblogs.com/chenxi-hxl/p/12321371.html

Path.Combine (合并两个路径字符串)方法的一些使用细节

System.IO.Path.Combine 简单来说,就是合并两个路径字符串. 比如如下调用,Path.Combine(@"C:\11","aa.txt") 返回的字符串路径如后: C:\11\aa.txt 这个方法的声明如下: public static string Combine ( string path1, string path2 ) 我们在合并一些目录的时候,它的两个参数有些特殊限制,下面我们就来依次看这些特殊限制 1.如果其中一个参数为 null

使用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)函数进行路径生成 明明是公有函数,为何会报错,奇了怪了 有谁知道什么原因?欢迎交流 ....... ... 重新打开了一下 ,可以了.版本原因 使用System.IO.Combine(string path1, string path2, string path3)四个参数的重载函数提示`System.IO.Path.Co

控制台基础概念实例

上一篇文章 控制台基础概念 介绍了控制的基本构成,以及一些操作处理.这一部分以实际代码为主,给出控制台使用的几个例子. 以main函数作为入口函数的程序都是控制台程序,最简单的控制台程序就是Hello World的程序.这里不给出了. GUI程序可以使用以下几种方式使用控制台: 在调用CreateProcess时使用CREATE_NEW_CONSOLE标志.(默认情况下,待启动进程为控制台程序时不推荐使用该参数,因为无法确定用户输入是有哪个控制台处理的) 通过 AttachConsole函数附加

控制台基础概念

一.引言 控制台程序(Console Application)相信是很多人接触编程的第一个界面,比如C/C++入门的Hello World程序,黑色的字符界面窗口,windows最经典的控制台程序是cmd(命令行窗口),如下图. MSDN上对控制台描述如下:用于管理基于字符的应用程序(不提供GUI界面)的输入输出. 本文主要参考MSDN上关于Console的资料,并加以整理扩充.原始资料可参考:http://msdn.microsoft.com/en-us/library/windows/des

C#控制台基础 directory获取一个文件夹中所有文件的绝对路径(不包括文件夹)

1 探测的文件夹 2 代码 1 using System; 2 using System.Collections.Generic; 3 using System.IO; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace directory创建一个文件夹 9 { 10 class Program 11 { 12 static void Main(string[] args)

C#控制台基础 directory获取一个文件夹下所有文件夹的名字(不包含文件)

1 探测的文件夹 2 代码 1 using System; 2 using System.Collections.Generic; 3 using System.IO; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace ConsoleApplication2 9 { 10 class Program 11 { 12 static void Main(string[] ar