[c#2] affectation entre deux tableaux en c#
bonjour tout le monde
voila j'ai créé deux tableaux de string , tab1 et tab2
Code:
1 2
| string[] tab1;
string[] tab2=null; |
en sachant que j'ai déjà rempli le tab1 par des chaines de caracteres et quand j'exécute le code suivant il m'affiche une exception
Code:
1 2 3 4 5 6 7 8 9
| for (int k = 0, j = 0; k< tab1.Length; k++)
{
if (tab1[k] !=" " )
{
tab2[j]=tab1[k]; //exception : Object reference not set to an instance of an object
j++;
}
} |
je vous remercie pour votre aide