[英]C# send data from Windows Forms to WCF service
Can i send a List from windows form to a wcf service? 我可以从Windows窗体向WCF服务发送列表吗? I'm using wcf web service.
我正在使用wcf网络服务。 I'm reading from a file in form and i want to send result to service.
我正在读取表单中的文件,并且想将结果发送给服务。
StreamReader file = new StreamReader(File.OpenRead(ofd.FileName));
List<string> lines = new List<string>();
List<double> fileResult = new List<double>();
while(!file.EndOfStream)
{
var line = file.ReadLine();
lines.Add(line);
}
file.Close();
for (int i = 0; i < lines.Count; i++)
{
fileResult.Add(Convert.ToDouble(lines[i]));
}
Yes, you can. 是的你可以。
However, you'll want to send/receive it either as an IEnumerable<double>
or a double[]
但是,您将需要以
IEnumerable<double>
或double[]
发送/接收它。
As for HOW (which you didn't ask) you may use this as a reference: http://www.codeproject.com/Articles/18789/A-Quick-and-Dirty-WCF-Service-and-Client-Using-WCF 至于HOW (您没有问过),您可以将其用作参考: http : //www.codeproject.com/Articles/18789/A-Quick-and-Dirty-WCF-Service-and-Client-Using -WCF
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.