ObjectQuery<T>.Skip(String, String, ObjectParameter[]) メソッド

定義

指定された条件でクエリの結果を並べ替え、指定された数の結果をスキップします。

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

結果の並べ替えに使用するキー列。

count
String

スキップする結果の数。 定数またはパラメーター参照を指定する必要があります。

parameters
ObjectParameter[]

解析時にスコープに含める必要があるオプションのクエリ パラメーターのセット。

戻り値

ORDER BYSKIP の両方が適用された元のインスタンスに相当する、新しい ObjectQuery<T> インスタンス。

例外

任意の引数が null です。

keys が空の文字列です。

- または -

count が空の文字列です。

この例では、クエリ結果の最初の 3 つをスキップした後に、 で並べ替えられた 5 つの Product オブジェクトを 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);
}

注釈

Skip メソッドを Top メソッドの後に使用することはできません。 の後で Skipを使用Topすると、句の ORDER BYLIMIT ステートメントのように機能します。

適用対象

こちらもご覧ください