如何将Python对象作为参数传递给C#程序 [英] How Do I Pass Python Object As Argument To C# Program

查看:495
本文介绍了如何将Python对象作为参数传递给C#程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#windows应用程序,我需要传递在python脚本中创建的对象 - 作为C#程序的参数和反之亦然。 那么如何将Python脚本创建的对象作为参数传递给C#程序。



为此,我不想要使用Iron-Python 。我的严格要求是使用通过运行C Python脚本创建的对象。我的Python脚本读取一个json文件并创建对象。



我的样本Json字符串:

{?xml:{@ version : 1.0\" , @编码: Windows的1252}, TestScript:{ TestExperiment:{ 测试1:{ 控制:[{ @类型:System.Windows.Forms的.TextBox @名称: 说明, @窗体名称: 测试1, 文本:空 可见: 真正的},{ @类型: System.Windows.Forms的。文本框 @名称: 客观, @窗体名称: 测试1, 文本:空 可见: 真正的},{ @类型: System.Windows.Forms.TextBox ,@ Name:Test1,@ FormName:Test1,Text:null,Visible:True}]}}}}



如果存在任何示例,它将非常有用..



谢谢,

I have a C# windows application, where i need to pass object created in python script - as argument to C# program and vice-verse. So how do i pass object created by Python script to C# program as parameter.

For this, i don't want to use Iron-Python. My strict requirement is to use object created by running the C Python scripts. My Python script reads a json file and creates object.

My sample Json string :
{"?xml":{"@version":"1.0","@encoding":"Windows-1252"},"TestScript":{"TestExperiment":{"Test1":{"Control":[{"@Type":"System.Windows.Forms.TextBox","@Name":"Description","@FormName":"Test1","Text":null,"Visible":"True"},{"@Type":"System.Windows.Forms.TextBox","@Name":"Objective","@FormName":"Test1","Text":null,"Visible":"True"},{"@Type":"System.Windows.Forms.TextBox","@Name":"Test1","@FormName":"Test1","Text":null,"Visible":"True"}]}}}}

If any example exists, it will really helpful..

Thanks,

推荐答案

这篇关于如何将Python对象作为参数传递给C#程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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