ObjectParameterCollection.CopyTo(ObjectParameter[], Int32) Method
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.
Allows the parameters in the collection to be copied into a supplied array, starting with the object at the specified index.
public:
virtual void CopyTo(cli::array <System::Data::Objects::ObjectParameter ^> ^ array, int index);
public void CopyTo (System.Data.Objects.ObjectParameter[] array, int index);
abstract member CopyTo : System.Data.Objects.ObjectParameter[] * int -> unit
override this.CopyTo : System.Data.Objects.ObjectParameter[] * int -> unit
Public Sub CopyTo (array As ObjectParameter(), index As Integer)
Parameters
- array
- ObjectParameter[]
The array into which to copy the parameters.
- index
- Int32
The index in the array at which to start copying the parameters.
Implements
Examples
This example copies the parameters into the specified array.
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;
ObjectParameter[] objectParameterArray =
new ObjectParameter[objectParameterCollection.Count];
objectParameterCollection.CopyTo(objectParameterArray, 0);
// Iterate through the ObjectParameter array.
for (int i = 0; i < objectParameterArray.Length; i++)
{
Console.WriteLine("Name: {0} Type: {1} Value: {2}",
objectParameterArray[i].Name,
objectParameterArray[i].ParameterType,
objectParameterArray[i].Value);
}
}
Applies to
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.
Athugasemdir
https://aka.ms/ContentUserFeedback.
Væntanlegt: Á árinu 2024 munum við hætta með GitHub-mál sem ábendingaleið fyrir efni og skipta því út fyrir nýtt ábendingakerfi. Frekari upplýsingar er að finna hér:Senda inn og skoða endurgjöf fyrir