C# 设置类属性的问题
我一直在得到一个空的异常;在下面ApiUsername和ApiPassword都有值,所以我不会怀疑我是否设置了错误的密码。凭据属性是需要设置用户名和密码属性的特定类型 所以我定义了自动属性: public CustomSecurityHeaderType SoapCallCredentials{get;private set;} 然后,无论何时命中,我都会得到一个空异常,并且不知道为什么C# 设置类属性的问题,c#,properties,C#,Properties,我一直在得到一个空的异常;在下面ApiUsername和ApiPassword都有值,所以我不会怀疑我是否设置了错误的密码。凭据属性是需要设置用户名和密码属性的特定类型 所以我定义了自动属性: public CustomSecurityHeaderType SoapCallCredentials{get;private set;} 然后,无论何时命中,我都会得到一个空异常,并且不知道为什么 private void SetApiCredentials() { SoapCallCreden
private void SetApiCredentials()
{
SoapCallCredentials = new CustomSecurityHeaderType
{
Credentials =
{
Username = PayPalConfig.CurrentConfiguration.ApiUserName,
Password = PayPalConfig.CurrentConfiguration.ApiPassword
}
};
UrlEndPoint = PayPalConfig.CurrentConfiguration.ExpressCheckoutSoapApiEndPoint;
}
我想你需要一个新的
Credentials = new WhatEverThisTypeIs()
{
Username = PayPalConfig.CurrentConfiguration.ApiUserName,
Password = PayPalConfig.CurrentConfiguration.ApiPassword
}
我想你需要一个新的
Credentials = new WhatEverThisTypeIs()
{
Username = PayPalConfig.CurrentConfiguration.ApiUserName,
Password = PayPalConfig.CurrentConfiguration.ApiPassword
}
从
首先需要实例化凭据,如:
Credentials = new UserIdPasswordType()
从
首先需要实例化凭据,如:
Credentials = new UserIdPasswordType()
您的凭据声明中是否缺少
new
?我想是的,但让我再试一次。您的凭据声明中是否缺少new
?我想是的,但让我再试一次。