12,162
社区成员
发帖
与我相关
我的任务
分享
//服务端契约实现:
public DataTable Returns(int n)
{
DataTable dt = new DataTable();
dt.TableName = "Program";
dt.Columns.Add("playTime", typeof(string));
dt.Columns.Add("meridiem", typeof(string));
dt.Columns.Add("tvProgram", typeof(string));
dt.Columns.Add("tvStationInfo", typeof(string));
DataRow newRow = dt.NewRow();
newRow["playTime"] = "09:10";
newRow["meridiem"] = "PM";
newRow["tvProgram"] = "开始";
newRow["tvStationInfo"] = "东方卫视";
dt.Rows.Add(newRow);
return dt;
}
//客户端:
DataTable dt = proxy.Returns(1);
string time = dt.Rows[0]["playTime"].ToString();
Console.WriteLine("编码方式自我寄宿:http://localhost:9999/calculatorservice");
Console.WriteLine("\r");
Console.WriteLine("x+y={2} when x={0} and y={1}", 1, 2, time);
Console.WriteLine("x-y={2} when x={0} and y={1}", 1, 2, time);
//得出x+y=09:10