- 阅读权限
- 255
- 威望
- 1 级
- 论坛币
- 49402 个
- 通用积分
- 51.7504
- 学术水平
- 370 点
- 热心指数
- 273 点
- 信用等级
- 335 点
- 经验
- 57815 点
- 帖子
- 4006
- 精华
- 21
- 在线时间
- 582 小时
- 注册时间
- 2005-5-8
- 最后登录
- 2023-11-26
|
- LISTING 4.12: Passing Variables by Value
- Click here to view code image
- class Program
- {
- static void Main()
- {
- // ...
- string fullName;
- string driveLetter = "C:";
- string folderPath = "Data";
- string fileName = "index.html";
- fullName = Combine(driveLetter, folderPath, fileName);
- Console.WriteLine(fullName);
- // ...
- }
- static string Combine(
- string driveLetter, string folderPath, string fileName)
- {
- string path;
- path = string.Format("{1}{0}{2}{0}{3}",
- System.IO.Path.DirectorySeparatorChar,
- driveLetter, folderPath, fileName);
- return path;
- }
- }
复制代码
|
|