ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: C#, c'est merveilleux - Olivier   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

dim. 06 avril 2008, 14h29
olivier Hamou
atoutfox.public.association

Re: C#, c'est merveilleux - Olivier


J'aime bien toutes ces possibilités
et surtout le aa.Length()

Merci, bon week end greg.

Olivier



Gregory a écrit :
> Olivier,
>
> Les indices commencent a zero - c'etait deja comme ca en C
> J'aime bien, cela a ses avantages
>
> string[] aa = { "1", "2", "3" };
> aa.GetLowerBound(0) >> 0
> aa.GetUpperBound(0) >> 2
>
> Mais, c'est logique
> for( int i = aa.GetLowerBound(0), i<= aa.GetUpperBound(0), i++)
> ..... ;
>
> Si tu n'as qu'une dimension, qui demarre a zero, tu prends aa.Length() -1
>
> S'il y a des methodes GetLowerBound(), GetUpperBound(), il y a bien une
> raison
>
> Il y a moyen de declarer des tableaux avec des GetLowerBound() <> 0
>
> static void doit()
> {
> int[] longueur = { 2, 3 };
> int[] lowerbound = { -3, 2 };
> int[] accessor = new int[2];
> ;
> Array tab = Array.CreateInstance(typeof(string), longueur,
> lowerbound);
>
> for (int i = tab.GetLowerBound(0); i <= tab.GetUpperBound(0);
> i++)
> {
> accessor[0] = i;
> for (int j = tab.GetLowerBound(1); j <=
> tab.GetUpperBound(1); j++)
> {
> accessor[1] = j;
> tab.SetValue(i.ToString() + " , " + j.ToString(),
> accessor);
> Console.WriteLine(tab.GetValue(accessor));
> }
> }
> }
> /*
> -3, 2
> -3, 3
> -3, 4
> -2, 2
> -2, 3
> -2, 4
> */
>
> Gregory
> _
> "OlivierH" <"nospam[contact]"@planitron.com> wrote in message
> news:fta0rm$139t$1@news.niouzes.net...
>> Autre inconvenient, pour debugger quand on est
>> en train de convertir de vfp à C# , les indices commencent à zero
>>
>> Pour retourner le nombre de ligne d'un tableau,
>> si j'ai 10 lignes
>> TAB.GetUpperBound(0) = il me renvoit 9 !
>>
>> Pas tres normal, je trouve !
>>
>> Olivier
>>
>>
>>
>>
>> OlivierH a écrit :
>>> L'aide en ligne est horrible,
>>>
>>> Olivier
>>>
>>>
>>>
>>> Gregory a écrit :
>>>> On perd des fois une heure a chercher un truc,
>>>> une demi heure a comprendre une erreur de compilation,
>>>> mais a part ca - c'est tres bien
>>>>
>
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000002185
20 286 messages dans le forum • Liste complète des messages

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2026.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3