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

定義

指定された条件でクエリの結果を並べ替え、指定された数の結果をスキップします。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)

パラメーター

keys
String String String String

結果の並べ替えに使用するキー列。The key columns by which to order the results.

count
String String String String

スキップする結果の数。The number of results to skip. 定数またはパラメーター参照を指定する必要があります。This must be either a constant or a parameter reference.

parameters
ObjectParameter[]

解析時にスコープに含める必要があるオプションのクエリ パラメーターのセット。An optional set of query parameters that should be in scope when parsing.

戻り値

ORDER BYSKIP の両方が適用された元のインスタンスに相当する、新しい ObjectQuery<T> インスタンス。A new ObjectQuery<T> instance that is equivalent to the original instance with both ORDER BY and SKIP applied.

例外

任意の引数が null です。Any argument is null.

keys が空の文字列です。keys is an empty string.

- または --or- count が空の文字列です。count is an empty string.

この例ではProduct 、クエリ結果の最初の3つをでProduct.ListPrice並べ替えた後、5つのオブジェクトを取得します。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

注釈

Skip メソッドを Top メソッドの後に使用することはできません。The Skip method cannot be used after the Top method. After TopSkip使用すると、句のLIMITステートメントと同様に機能します。When you use Top after Skip, it functions like the LIMIT statement of an clause.

適用対象

こちらもご覧ください