组装成字符串再返回啊
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime .InteropServices ;namespace WindowsApplication246
{
[ComVisible (true )]
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); WebBrowser WB = new WebBrowser();
WB.Parent = this;
WB.Dock = DockStyle.Fill;
WB.DocumentText = "<input type='button' value='!!!!!' onclick='alert(window.external.X)'/>"; WB.ObjectForScripting = this;
} public struct S
{
public int A;
public String B;
} public String X()
{
S s = new S();
s.A = 1;
s.B = "ZZZ"; return s.A.ToString() + ";" + s.B;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime .InteropServices ;namespace WindowsApplication246
{
[ComVisible (true )]
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); WebBrowser WB = new WebBrowser();
WB.Parent = this;
WB.Dock = DockStyle.Fill;
WB.DocumentText = "<input type='button' value='!!!!!' onclick='alert(window.external.X)'/>"; WB.ObjectForScripting = this;
} public struct S
{
public int A;
public String B;
} public String X()
{
S s = new S();
s.A = 1;
s.B = "ZZZ"; return s.A.ToString() + ";" + s.B;
}
}
}
可调用C#里的方法
web.ObjectForScripting = this;
啥都解决了。
json 可以表示复杂的数据结构,利器