ObjectParameterCollection.Count Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the number of parameters currently in the collection.
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
Property Value
The number of ObjectParameter objects that are currently in the collection.
Implements
Examples
This example adds new parameters to the collection and gets the count of the parameters in the collection. Then it iterates through the ObjectParameterCollection and displays the name, type, and value of each parameter in the collection.
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;
Console.WriteLine("Count is {0}.", objectParameterCollection.Count);
// Iterate through the ObjectParameterCollection collection.
foreach (ObjectParameter result in objectParameterCollection)
{
Console.WriteLine("{0} {1} {2}", result.Name,
result.Value,
result.ParameterType);
}
}
Applies to
See also
GitHub पर हमारे साथ सहयोग करें
इस सामग्री का स्रोत GitHub पर पाया जा सकता है, जहाँ आप समस्याएँ बना और समीक्षा भी कर सकते हैं और अनुरोध खींच सकते हैं. अधिक जानकारी के लिए, हमारे योगदानकर्ता गाइड देखें.