我已经在 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
关于vb.net - 在 vb.net 中获取命令行参数的最佳方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32616682/