Vb.net在命令行参数中传递一个对象 [英] Vb.net pass an object in command line arguments

查看:264
本文介绍了Vb.net在命令行参数中传递一个对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

美好的一天!!!



我们有办法将类传递给exe文件?



样品,我有一个班级人员



Hi All,
Good Day!!!

is there a way in which we can pass a class to an exe file?

Sample, i have a class Person

Public Class Person
        Property Name As String
        Property Age As String
        Property Address As String
    End Class





在exe文件中我想以



addperson.exe人



或有可能我可以转换说班级到一个字符串,反之亦然?



提前谢谢你,希望我会得到大师们的回复。



我尝试了什么:



曾尝试将类转换为字符串但未成功。



in the exe file i would like to execute it as

addperson.exe person

or is there a possibility that i could convert the said class to a string and vice versa?

thank you in advance and hoping i would have a response from the masters out there.

What I have tried:

Had tried to convert the class to string but not successful.

推荐答案

你需要传递一个字符串 - args()是一个字符串数组。



你可以序列化通过某种方式将对象传递给文件,然后将该文件名作为参数传递并对软件内的对象进行反序列化
You would need to pass a string - args() is a string array.

You could serialise the object to a file by some means, and then pass that filename as an argument and deserialise the object inside your software


不作为单个对象 - 您只能将字符串作为命令行参数传递。



您可以将所有三个字符串作为单独的参数传递,方法是将每个字符串用双引号括起来并用空格分隔,或者如果您可以控制其他应用程序,则可以使用参数格式传递三个字符串。例如,string one | string two | string 3作为单个参数,然后使用Split将其拆分为另一端。
Not as a single object - you can only pass strings as command line arguments.

You can pass all three strings as separate arguments by surrounding each with double quotes and separating them with spaces, or if you have control over the other application you could come up with a argument format that passes the three strings. For example, "string one|string two|string 3" as a single argument and then use Split to break it up at the other end.


这篇关于Vb.net在命令行参数中传递一个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆