在实现webserices的代码时遇到问题 [英] Having issue when implementing code for webserices
问题描述
我正在使用Visual Basics IDE
C#是代码。
使用System;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
名称空间DinerMax3000.business
{
公共类MenuItem
{
public string Title {get;组; }
公共字符串描述{get;组; }
公共双倍价格
{
得到{
cd
Business.CDyne.WeatherSoapClient = new Business.CDyne.WeatherSoapClient();
return _price; }
set
{
if(value> 0)
{
_price = value;
}
else
{
抛出新的ApplicationException(测试应用程序);
}
}
}
私人双_价格;
}
}
我尝试了什么:
我试过这段代码来解决错误
Business.CDyne.WeatherSoapClient = new Business.CDyne.WeatherSoapClient();
但理想情况是我会使用以下
CDyne.WeatherSoapClient - 新的Business.CDybe.WeatherSoapClient();
I'm using the Visual Basics IDE
C# is the code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DinerMax3000.business
{
public class MenuItem
{
public string Title { get; set; }
public string Description { get; set; }
public double Price
{
get {
cd
Business.CDyne.WeatherSoapClient = new Business.CDyne.WeatherSoapClient();
return _price; }
set
{
if (value > 0)
{
_price = value;
}
else
{
throw new ApplicationException("Testing Application");
}
}
}
private double _price;
}
}
What I have tried:
I have tried this code to get around the errors
Business.CDyne.WeatherSoapClient = new Business.CDyne.WeatherSoapClient();
however the ideal scenario would be that I would use the following
CDyne.WeatherSoapClient - new Business.CDybe.WeatherSoapClient();
推荐答案
WeatherSoapC lient类将有一个获取Price的方法,你必须调用该方法并将其分配给_price变量,如下所示。
The WeatherSoapClient class will have having a method to get the Price, you will have to call that method and assign it to the _price variable as below.
public double Price
{ get
{
Business.CDyne.WeatherSoapClient obj = new Business.CDyne.WeatherSoapClient();
_price = obj.yourMethodNameToGetPrice();
return _price;
}
set
{
if (value > 0)
{
_price = value;
}
else
{
throw new ApplicationException("Testing Application");
}
}
}
这篇关于在实现webserices的代码时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!