Data Binding with object array

K

kin

After a I read Walkthrough: Connecting to Data in Objects
(http://msdn2.microsoft.com/en-us/library/ms171892.aspx#Mtps_DropDownFilterText).
I still have project on that.

My School project provided me an array of objects - News, but VS 2005 seams
only accept Collections like IList<News> for DataBinding.

I can convert an array to IList<News> list = (IList<News>)news, but IList is
not a class, so I tried to create a class that extends IList<News>. wahaha,
c# does not accept it.

Any one have idea to data binding with an object array in c# 2.0, or
have idea to change a array to a Collections, and that collections can do
datebinding?


Sorry for you very poor English.

Kin
 
A

Aboulfazl Hadi

Hi kin
As far as I understand your problem, you want to store a list of
objects for databinding. You can use BindingList a generic collection
for this purpose.

BindingList provides a concrete, generic implementation of the
IBindingList interface.

I hope this helps
A.Hadi
 
K

kin

but any idea to convery array - News[], to a BindingList<News>??
like the example in MSDN, i created a class
class NewsCountCollection:
System.ComponentModel.BindingList<NewsCountEntity>
{

}
but i have no idea to convert the array to BindingList.

Thanks!!

Kin
 
M

Marc Gravell

Personally I'd just use List<News>; one of the ctors of this will accept
your array, and it supports IList.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top