共用方式為


ObjectParameter.ParameterType 屬性

定義

取得參數型別。

public:
 property Type ^ ParameterType { Type ^ get(); };
public Type ParameterType { get; }
member this.ParameterType : Type
Public ReadOnly Property ParameterType As Type

屬性值

參數的 Type

範例

本範例會將新的參數新增至集合。 它會逐一查看 ObjectParameterCollection 並顯示集合中每個參數的名稱、型別和值。

using (AdventureWorksEntities context =
    new AdventureWorksEntities())
{
    string queryString =
        @"SELECT VALUE contact FROM AdventureWorksEntities.Contacts
        AS contact WHERE contact.LastName = @ln
        AND contact.FirstName = @fn";

    ObjectQuery<Contact> contactQuery =
        new ObjectQuery<Contact>(queryString, context);

    // Add parameters to the collection.
    contactQuery.Parameters.Add(new ObjectParameter("ln", "Adams"));
    contactQuery.Parameters.Add(new ObjectParameter("fn", "Frances"));

    ObjectParameterCollection objectParameterCollection =
        contactQuery.Parameters;

    // Iterate through the ObjectParameterCollection.
    foreach (ObjectParameter result in objectParameterCollection)
    {
        Console.WriteLine("{0} {1} {2}", result.Name,
            result.Value,
            result.ParameterType);
    }
}

備註

參數型別只能透過建構函式設定。

適用於

另請參閱