ValidatorCollection.CopyTo(Array, Int32) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Copie la collection de validateurs vers le tableau spécifié, en commençant à l'emplacement spécifié.
public:
virtual void CopyTo(Array ^ array, int index);
public void CopyTo (Array array, int index);
abstract member CopyTo : Array * int -> unit
override this.CopyTo : Array * int -> unit
Public Sub CopyTo (array As Array, index As Integer)
Paramètres
- array
- Array
Collection à laquelle le contrôle serveur de validation est ajouté.
- index
- Int32
Index où le contrôle serveur de validation est copié.
Implémente
Exemples
L’exemple de code suivant illustre l’utilisation de la CopyTo méthode .
// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = Page.Validators ;
// Object Array.
Object[] myObjArray = new Object[5] { 0, 0, 0, 0, 0 };
// Copy the 'Collection' to 'Array'.
myCollection.CopyTo(myObjArray,0);
// Print the values in the Array.
string myStr = " ";
for(int i = 0; i<myCollection.Count; i++)
{
myStr += myObjArray[i].ToString();
myStr += " ";
}
msgLabel.Text = myStr;
' Get 'Validators' of the page to myCollection.
Dim myCollection As ValidatorCollection = Page.Validators
Dim myObjArray() As Object = New Object(4){0, 0, 0, 0, 0}
' Copy the 'Collection' to 'Array'.
myCollection.CopyTo(myObjArray, 0)
' Print the values in the Array.
Dim myStr As String = " "
Dim i As Integer
For i = 0 To myCollection.Count - 1
myStr += myObjArray(i).ToString()
myStr += " "
Next i
msgLabel.Text = myStr
S’applique à
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de l’année 2024, nous abandonnerons progressivement le mécanisme de retour d’information GitHub Issues pour le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez :Soumettre et afficher des commentaires pour