ObjectQuery<T>.Skip(String, String, ObjectParameter[]) ObjectQuery<T>.Skip(String, String, ObjectParameter[]) ObjectQuery<T>.Skip(String, String, ObjectParameter[]) ObjectQuery<T>.Skip(String, String, ObjectParameter[]) Method

Definición

Ordena los resultados de la consulta según los criterios especificados y omite un número especificado de resultados.Orders the query results by the specified criteria and skips a specified number of results.

public:
 System::Data::Objects::ObjectQuery<T> ^ Skip(System::String ^ keys, System::String ^ count, ... cli::array <System::Data::Objects::ObjectParameter ^> ^ parameters);
public System.Data.Objects.ObjectQuery<T> Skip (string keys, string count, params System.Data.Objects.ObjectParameter[] parameters);
member this.Skip : string * string * System.Data.Objects.ObjectParameter[] -> System.Data.Objects.ObjectQuery<'T>
Public Function Skip (keys As String, count As String, ParamArray parameters As ObjectParameter()) As ObjectQuery(Of T)

Parámetros

keys
String String String String

Columnas de clave por las que se deben ordenar los resultados.The key columns by which to order the results.

count
String String String String

Número de resultados que se van a omitir.The number of results to skip. Este valor debe ser una constante o una referencia de parámetro.This must be either a constant or a parameter reference.

parameters
ObjectParameter[]

Conjunto opcional de parámetros de consulta que deberían estar en el ámbito durante el análisis.An optional set of query parameters that should be in scope when parsing.

Devoluciones

Nueva instancia de ObjectQuery<T> que es equivalente a la instancia original, pero aplicando ORDER BY y SKIP.A new ObjectQuery<T> instance that is equivalent to the original instance with both ORDER BY and SKIP applied.

Excepciones

keys es una cadena vacía.keys is an empty string.

O bien-or- count es una cadena vacía.count is an empty string.

Ejemplos

En este ejemplo se obtiene cinco Product objetos después de omitir los tres primeros resultados de la consulta, ordenados por Product.ListPrice.This example gets five Product objects after skipping the first three in the query result, sorted by Product.ListPrice.

using (AdventureWorksEntities context =
    new AdventureWorksEntities())
{
    // Define the parameters used to define the "page" of returned data.
    int skipValue = 3;
    int limitValue = 5;

    // Define a query that returns a "page" or the full 
    // Product data using the Skip and Top methods. 
    // When Top() follows Skip(), it acts like the LIMIT statement.
    ObjectQuery<Product> query = context.Products
        .Skip("it.ListPrice", "@skip",
                new ObjectParameter("skip", skipValue))
        .Top("@limit", new ObjectParameter("limit", limitValue));

    // Iterate through the page of Product items.
    foreach (Product result in query)
        Console.WriteLine("ID: {0}; Name: {1}",
        result.ProductID, result.Name);
}
Using context As New AdventureWorksEntities()
    ' Define the parameters used to define the "page" of returned data. 
    Dim skipValue As Integer = 3
    Dim limitValue As Integer = 5

    ' Define a query that returns a "page" or the full 
    ' Product data using the Skip and Top methods. 
    ' When Top() follows Skip(), it acts like the LIMIT statement. 
    Dim query As ObjectQuery(Of Product) = _
        context.Products.Skip("it.ListPrice", "@skip", _
            New ObjectParameter("skip", skipValue)).Top("@limit", New ObjectParameter("limit", limitValue))

    ' Iterate through the page of Product items. 
    For Each result As Product In query
        Console.WriteLine("ID: {0}; Name: {1}", result.ProductID, result.Name)
    Next
End Using

Comentarios

El método Skip no se puede usar después del método Top.The Skip method cannot be used after the Top method. Cuando usas Top después Skip, funciona como el límite instrucción de una cláusula.When you use Top after Skip, it functions like the LIMIT statement of an clause.

Se aplica a

Consulte también: