DataKeyArray Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a collection of DataKey objects. This class cannot be inherited.
public ref class DataKeyArray sealed : System::Collections::ICollection, System::Web::UI::IStateManager
public sealed class DataKeyArray : System.Collections.ICollection, System.Web.UI.IStateManager
type DataKeyArray = class
interface ICollection
interface IEnumerable
interface IStateManager
Public NotInheritable Class DataKeyArray
Implements ICollection, IStateManager
- Inheritance
-
DataKeyArray
- Implements
Examples
The following code example demonstrates how to use the indexer to retrieve a DataKey object from a DataKeyArray collection.
<%@ Page language="C#" %>
DataKeyArray Example
<%@ Page language="VB" %>
DataKeyArray Example
The following code example demonstrates how to iterate through a DataKeyArray collection.
<%@ Page language="C#" %>
DataKeyArray Example
<%@ Page language="VB" %>
DataKeyArray Example
Remarks
The DataKeyArray class is used to store and manage a collection of DataKey objects. A DataKey object represents the primary key of a record in a data-bound control. In general, data-bound controls that display multiple records (such as the GridView control) use a DataKeyArray object to store the DataKey objects for the records displayed in the control.
The DataKeyArray class supports several ways to access the items in the collection:
Use the Item[] indexer to directly retrieve a DataKey object from the collection at a specific zero-based index.
Use the GetEnumerator method to retrieve an enumerator that can be used to iterate through the collection.
Use the CopyTo method to copy the items in the collection into an array, which can then be used to access the items in the collection.
To determine the total number of items in the collection, use the Count property.
Constructors
| Name | Description |
|---|---|
| DataKeyArray(ArrayList) |
Initializes a new instance of the DataKeyArray class. |
Properties
| Name | Description |
|---|---|
| Count |
Gets the number of items in the collection. |
| IsReadOnly |
Gets a value indicating whether the items in the collection can be modified. |
| IsSynchronized |
Gets a value indicating whether the DataKeyArray collection is synchronized (thread safe). |
| Item[Int32] |
Gets the DataKey object from the collection at the specified index. |
| SyncRoot |
Gets the object used to synchronize access to the collection. |
Methods
| Name | Description |
|---|---|
| CopyTo(DataKey[], Int32) |
Copies all the items from this collection to the specified array of DataKey objects, starting at the specified index in the array. |
| Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
| GetEnumerator() |
Returns an enumerator that contains all DataKey objects in the collection. |
| GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
| GetType() |
Gets the Type of the current instance. (Inherited from Object) |
| MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
| ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copies all the items from this collection to the specified Array, starting at the specified index in the Array. |
| IStateManager.IsTrackingViewState |
Gets a value indicating whether the DataKeyArray object is tracking its view-state changes. |
| IStateManager.LoadViewState(Object) |
Loads the previously saved view state of the DataKeyArray object. |
| IStateManager.SaveViewState() |
Saves the current view state of the DataKeyArray object. |
| IStateManager.TrackViewState() |
Marks the starting point at which to begin tracking and saving view-state changes to the DataKeyArray object. |
Extension Methods
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
Enables parallelization of a query. |
| AsQueryable(IEnumerable) |
Converts an IEnumerable to an IQueryable. |
|
Cast |
Casts the elements of an IEnumerable to the specified type. |
|
OfType |
Filters the elements of an IEnumerable based on a specified type. |