我正在尝试检查联系人是否存在,或者没有使用Utility.searchbyemail选项。
示例:IList myList = Utility.SearchContactByEmail(authdata,emailAddress,out nextChunkId);
上面的语句引发一个错误: Error 不能隐式地将'System.Collections.Generic.IList‘类型转换为’System.Collection tions.Generic.IList‘。存在显式转换(是否缺少强制转换?)。
任何帮助都是非常感谢的。下面是我的代码供参考,我希望我有所有的名称空间到位。
enter code here
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using ConstantContactBO;
using ConstantContactUtility;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication4
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ConstantContactBO.Contact c = new ConstantContactBO.Contact();
c.EmailAddress = "";
AuthenticationData authdata = new AuthenticationData();
authdata.Username = "";
authdata.Password = "";
authdata.ApiKey = "";
// get user Contact List collection
string nextChunkId;
string currentChunk;
string x = "a@abc.com";
string[] emailAddress = new string[]{x.Trim()};
IList<ContactList> lists = Utility.GetUserContactListCollection(authdata, out nextChunkId);
**IList<Contact> myList = Utility.SearchContactByEmail(authdata, emailAddress, out nextChunkId);** //Throws Error here
}
}
}发布于 2012-11-13 22:12:59
我解决了。问题在于名称空间WebApplication4的使用。
https://stackoverflow.com/questions/13369233
复制相似问题