[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Question about DataSource property in Repeater class

Nicolas Ivering

12/25/2002 10:24:00 PM

Hi.

The documentation for the Repeater class says:
"The DataSource can be any System.Collections.IEnumerable derived object
such as a System.Data.DataView for accessing databases, an
System.Collections.ArrayList, a System.Collections.Hashtable, or an array."

If it is only supposed to accept System.Collections.IEnumerable, how
come the type of the property is "object"?

Thankful for any clues.

/Nicolas

2 Answers

Alex Mondale

12/10/2002 4:02:00 PM

0

Nicolas,
As I understand it, *Every*thing in .Net derives directly from
"System.Object". IEnumerable (being of the geverb form) signifies a property
of the System.Collections *Object* and not a method/event.
Hope this helps muddle things completely,
Alex


"Nicolas Ivering" <nicolasnospamivering@greenmill.se> wrote in message
news:3df5f317$1@news.wineasy.se...
> Hi.
>
> The documentation for the Repeater class says:
> "The DataSource can be any System.Collections.IEnumerable derived object
> such as a System.Data.DataView for accessing databases, an
> System.Collections.ArrayList, a System.Collections.Hashtable, or an
array."
>
> If it is only supposed to accept System.Collections.IEnumerable, how
> come the type of the property is "object"?
>
> Thankful for any clues.
>
> /Nicolas
>


Nicolas Ivering

12/25/2002 10:25:00 PM

0

Yes, everything is an object so naturally setting the property to an
instance of an object of IEnumerable works. However, since the type of
DataSorce is object, I can write "repeater.Datasource = new Object();"
without getting a compile-time error even though Object does not
implement the IEnumerable interface. So why let the programmer assign
_any_ object to the DataSource property when in fact according to the
documentation it only works with object of classes that implements
IEnumerable?

/Nicolas

Alex Mondale wrote:
> Nicolas,
> As I understand it, *Every*thing in .Net derives directly from
> "System.Object". IEnumerable (being of the geverb form) signifies a property
> of the System.Collections *Object* and not a method/event.
> Hope this helps muddle things completely,
> Alex
>
>
> "Nicolas Ivering" <nicolasnospamivering@greenmill.se> wrote in message
> news:3df5f317$1@news.wineasy.se...
>
>>Hi.
>>
>>The documentation for the Repeater class says:
>>"The DataSource can be any System.Collections.IEnumerable derived object
>>such as a System.Data.DataView for accessing databases, an
>>System.Collections.ArrayList, a System.Collections.Hashtable, or an
>
> array."
>
>>If it is only supposed to accept System.Collections.IEnumerable, how
>>come the type of the property is "object"?
>>
>>Thankful for any clues.
>>
>>/Nicolas
>>
>
>
>