vs2008 c#:将事件添加到facebook的winform应用程序的eventlist控件
问题描述:
这是一个桌面应用程序。如何将事件添加到事件列表控件?下面的代码是不工作vs2008 c#:将事件添加到facebook的winform应用程序的eventlist控件
IList<user> friends = facebookService1.Friends.GetUserObjects();
IList<facebookevent> events = facebookService1.Events.Get();
friendList1.Friends = friends;
eventList1.FacebookEvents = events;
错误信息
错误1无法隐式转换类型“System.Collections.Generic.IList”到“System.Collections.ObjectModel.Collection”。 C:\ Documents and Settings \ ZULFIQAR SYED \ Local Settings \ Application Data \ Temporary Projects \ WindowsFormsApplication1 \ Form1.cs 42 41 WindowsFormsApplication1
答
您的意思是受保护的Events
成员(EventHandlerList
)?
private static readonly object MyEventKey = new object();
public event EventHandler MyEvent
{
add {Events.AddHandler(MyEventKey, value);}
remove {Events.RemoveHandler(MyEventKey, value);}
}
protected virtual void OnMyEvent()
{
EventHandler handler = (EventHandler)Events[MyEventKey];
if (handler != null) handler(this, EventArgs.Empty);
}
您确认Facebook服务是否确实返回IList ? – 2009-12-31 23:57:38