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 つをスキップした後、Product.ListPrice順に並べ替えられた 5 つのProduct オブジェクトを取得します。

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 BY句の LIMIT ステートメントのように機能します。

適用対象

こちらもご覧ください