码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2016-10-11 21:30:34      阅读:618      评论:0      收藏: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(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 效果

技术分享

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

标签:

原文地址:http://www.cnblogs.com/jinlingzi/p/5950604.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!