开发者

How to implement IDataSource interface for a custom generic collection in C#

I am using DataView in SharePoint. I want to bind a collection of objects to the DataView. But when I am trying to bind it is giving the error that the collection does开发者_C百科 not implement IDataSource interface. Can anybody tell me how to extend the collection class to implement IDataSource interface?

Thanks Ashwani


An interface is a public contract- implementing an interface means that the class implements each of the methods declared in the interface. Your collection class will have to be defined as implementing IDataSource:

public class MyClass : IDataSource

and then implement each IDataSource method:

DataSourceView IDataSource.GetView(string viewName)
{
//your code here
}
...etc.

See MSDN for more details

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜