public string transmiss(Data[] d) { var tw = new System.IO.StringWriter(); var ser = new Serializer(); ser.Serialize(tw, d.Select(x => new { x.id, x.src, x.dst })); return tw.ToString(); }
private void buttonAdd_Click(object sender, EventArgs e) { try { textResult.Clear(); var dll = plugins[textPlugin.Text]; var d = new Data(); d.id = (int)numDataID.Value; d.src = textSrc.Text; d.dst = textDst.Text; moredata.Add(d); textResult.AppendText(dll.transmiss(moredata.ToArray()) + "\r\n"); } catch (Exception ec) // 插件选取失败, 此时可以使用 fall-back 方法 { textResult.AppendText(ec.ToString() + "\r\n"); } }
public string transmiss(Data[] d) { return "This is Glynda"; }