[英]What is the best way for grabbing command line arguments in vb.net
我已经在c#中完成了几次,但是对于vb.net,我可以如下使用My.Application.CommandLineArgs还是有更好的方法?
Dim argListArray As New ArrayList
For Each argument As String In My.Application.CommandLineArgs
argListArray.Add(argument)
Next
If argListArray.Count = 5 Then
ImageName = argListArray(0).ToString
ImageAddress = argListArray(1).ToString
ImagePort = argListArray(2).ToString
FileLoc = argListArray(3).ToString
JPEGQuality = argListArray(4).ToString
Else
'TODO invalid # args
End If
同意...只需直接使用My.Application.CommandLineArgs
:
If My.Application.CommandLineArgs.Count = 5 Then
ImageName = My.Application.CommandLineArgs(0)
ImageAddress = My.Application.CommandLineArgs(1)
ImagePort = My.Application.CommandLineArgs(2)
FileLoc = My.Application.CommandLineArgs(3)
JPEGQuality = My.Application.CommandLineArgs(4)
Else
' TODO invalid # args
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.