手机
当前位置:查字典教程网 >编程开发 >C#教程 >C#访问命令行的两种方法
C#访问命令行的两种方法
摘要:本文实例讲述了C#访问命令行的两种方法。分享给大家供大家参考。具体如下:方法1://参数:ABCusingSystem;publicclas...

本文实例讲述了C#访问命令行的两种方法。分享给大家供大家参考。具体如下:

方法1:

// 参数:A B C using System; public class CommandLine { public static void Main(string[] args) { // Length 属性用于获取数组的长度。 // 注意,Length 是只读属性: Console.WriteLine("Number of command line parameters = {0}", args.Length); for(int i = 0; i < args.Length; i++) { Console.WriteLine("Arg[{0}] = [{1}]", i, args[i]); } } }

方法2:

// 参数:John Paul Mary using System; public class CommandLine2 { public static void Main(string[] args) { Console.WriteLine("Number of command line parameters = {0}", args.Length); foreach(string s in args) { Console.WriteLine(s); } } }

希望本文所述对大家的C#程序设计有所帮助。

【C#访问命令行的两种方法】相关文章:

C#连接Oracle数据库的实例方法

关于C#程序优化的五十种方法

c#中虚函数的相关使用方法

C# 读取指定路径配置文件的方法

C# 语音功能的实现方法

C#下解析HTML的两种方法介绍

C# 写入XML文档三种方法详细介绍

c#解压文件的实例方法

C# 格式化字符首字母大写的方法

C#技巧之快速删除bin和obj文件夹的方法

精品推荐
分类导航