惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
T
Tenable Blog
T
Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Security Latest
Security Latest
P
Privacy & Cybersecurity Law Blog
Google Online Security Blog
Google Online Security Blog
SecWiki News
SecWiki News
P
Palo Alto Networks Blog
TaoSecurity Blog
TaoSecurity Blog
Webroot Blog
Webroot Blog
Spread Privacy
Spread Privacy
O
OpenAI News
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
C
Check Point Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
人人都是产品经理
人人都是产品经理
S
Security @ Cisco Blogs
Scott Helme
Scott Helme
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
T
Troy Hunt's Blog
W
WeLiveSecurity
GbyAI
GbyAI
N
News | PayPal Newsroom
Y
Y Combinator Blog
C
Cisco Blogs
H
Help Net Security
The GitHub Blog
The GitHub Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 【当耐特】
Jina AI
Jina AI
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
小众软件
小众软件
N
News and Events Feed by Topic

博客园 - Haozes

新Blog 拼写检查算法 Golang 版 Windbg 离线调试.Net 程序入门 (译)你必须知道的位运算技巧 Low Level Bit Hacks You Absolutely Must Know Windows 下 命令行增强工具 WPF Layout & Image异步加载 几篇文章了解编译原理 WPF Binding Validation 数据验证 WPF 实现Loading效果 常用开发工具介绍 使用.Net Memory Profiler 分析.Net程序内存泄露 使用Mdbg.exe 调试.Net 程序 WPF 多语言方案 .Net 2 Tip :捕获CSE和Thread.Timer与Thread.Sleep比较 使用CSharp Driver操作Mongodb介绍 使用Python操作MSSQL数据库. 运行.Net4.0程序是否要安装之前的.Net版本 javascript Disable <div> or other tag in Other Browser like FF,Chrome Delphi 无类型参数传递动态数组和静态数组
推荐一个.NET 命令行参数Parser 库
Haozes · 2012-06-07 · via 博客园 - Haozes

Command Line Parser Library 是个很简洁方便的 命令参数解析的类库,代码也不多,只两个cs文件,但功能一点也不少.
先看下QuickStart:

Test.exe, Program.cs:

class Options
  {
      [Option("d", "debug", DefaultValue = false, HelpText = "Debug Mode.")]
      public bool Debug { get; set; }
      [Option("h", "help", DefaultValue = false, HelpText = "Show Help")]
      public bool ShowHelp { get; set; }
      [HelpOption]
      public string GetUsage()
      {
          var usage = new StringBuilder();
          usage.AppendLine("Use -d or -debug to Debug");
          return usage.ToString();
      }
  }
  class Program
  {
      static void Main(string[] args)
      {
          var options = new Options();
          CommandLineParser.Default.ParseArguments(args, options);
          if (options.ShowHelp)
          {
              Console.WriteLine(options.GetUsage());
              return;
          }
          if (options.Debug)
          {
              Console.WriteLine("debug");
          }
       }
  }

其中,d参数是debug的全称,可以使用-d或者-debug.并可以指定默认值
测试:
Test.exe –d
Test.exe –h  显示使用帮助信息

除了简单的参数外,还支持列表参数,数组等,详细的用法,参照:
http://commandline.codeplex.com/documentation
现在这个代码库已迁移到GitHub. Git现在越来越红了,连Codeplex现在也开始支持Git了