手机
当前位置:查字典教程网 >编程开发 >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#程序优化的五十种方法

C#计算代码执行时间的方法

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

C# 调用C++写的dll的实现方法

C# DataGridView添加新行的2个方法

c# TreeView添加右键快键菜单有两种方法

C# dynamic关键字的使用方法

C#访问PostGreSQL数据库的方法

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

C#对XML文件的各种操作实现方法

精品推荐
分类导航