Data Binding Sources

I l @ ve RuBoard

Suitable sources for data binding include any object that exposes the IList interface. Most of the .NET collections implement this interface. Data objects provided by ADO.NET also expose Ilist , and you can also write your own objects that expose data through this interface.

The IList Interface

The Ilist interface has only a few methods . They are as follows :

  • Add adds an item to the list.

  • Clear removes all items from a list.

  • Contains searches a list for a certain value.

  • IndexOf determines the index of a particular value within the list.

  • Insert places a value into the list before a given index. This moves all following indexes up one and makes the list longer.

  • Remove takes an item out of the list.

  • RemoveAt removes one item from a specific index.

Accessing items within the list is done by index. For example, Item x = MyList[n] items are assumed to be objects so any data can be stored in a list if it's a boxed value type or if it's a .NET object.

Some .NET Objects That Implement IList

There are a lot of classes in the framework that implement IList . Some of them are just for accessing data. The Array , ArrayList , and StringCollection classes are very commonly used. More complex classes include DataSetView and DataView , which work in conjunction with ADO to provide data table access.

The less mundane classes that support the interface are used extensively by the .NET developer tools for looking at the metadata associated with classes. These include the CodeClassCollection and the CodeStatementCollection classes and other objects that use the code Document Object Model or DOM.

I l @ ve RuBoard


C# and the .NET Framework. The C++ Perspective
C# and the .NET Framework
ISBN: 067232153X
EAN: 2147483647
Year: 2001
Pages: 204

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net