dim. 22 juin 2008, 19h13
Gregory
atoutfox.public.association
Re: C# et le WITH
Olivier,
Il n'y a pas de with/endwith, par contre quand tu utilises le new, tu peux
initialiser comme un si c'etait un tableau
Exemple tableau
int[] tab = new int[] {1,2,3};
exemple avec une classe
supposons
public class Commande
{
public int No;
public int Client;
public List<LigneCommande> Lignes;
}
public class LigneCommande
{
public int Article;
public int qty;
}
alors
static void main()
{
var commande = new Commande
{
No = 123,
Client = 456,
Lignes = new List<LigneCommande>()
{
new LigneCommande { Article = 123, qty = 1},
new LigneCommande { Article = 789, qty = 2}
}
};
}
Cela va te soulager un peu - j'espere
Gregory
_
"OlivierH" <"nospam[contact]"@planitron.com> wrote in message
news:g13hec$2sr$1@news.niouzes.net...
> Et oui gregory,
>
> J'ai fait cela !
>
> dataRow DR = ds.tables[0].rows[0];
>
>
> Et donc j'utilise DR
> au lieu de With ds.tables(0).rows(0);
>
> Mais michel a bien raison, c'est un petit plus de VB,
>
> Enfin bon la methode par une variable TMP ca me va !
>
>
> Olivier,
>
>
> Gregory a écrit :
>> Oui, Olivier, pas de with/endwith
>>
>> Mais on peut creer une variable tmp avec un nom court
>>
>> var x = UnObjetAvecUnNomTresLong;
>> x.Name = "pp";
>> x.... = ...;
>>
--
Gregory
__
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000002422