Défintion d'un tableau dans une classe

borgeomi Messages postés 77 Date d'inscription mercredi 20 juin 2001 Statut Membre Dernière intervention 23 juin 2011 - 4 juil. 2007 à 11:53
ricklekebekoi Messages postés 303 Date d'inscription mardi 11 février 2003 Statut Membre Dernière intervention 24 avril 2009 - 5 juil. 2007 à 02:06
borgeomibonjouuuuuuur !!!!!


borgeomibonjouuuuuuur !!!!!

J'ai une classe DataEis

je récupère dans une zone string des horaires de la semaine

exemple lundi
matin de à
après midi de à
de même pour mardi 
etc  
Voici le string récupéré
090012001400190009001200140019000900120014001900090012001400190009001200140019000900120014001900

Question ==> à la place de crée des zones string hor10 hor11 etc

j'aimerais définir un tableau horaires et insérer mes valeurs 4 caractères par caratères
et de plus gérér les accesseurs GET et SET  

Mrci d'avance


publicclassDataEIS



{







// -- Correspondant technique






private



string
_NomCorr;


public



string
nomCorr{


get
{

return
_NomCorr; }


set
{ _NomCorr =

value
; }}








private



string
_Hor10;


public



string
hor10{


get
{

return
_Hor10; }


set
{ _Hor10 =

value
; }}


private



string
_Hor11;


public



string
hor11{


get
{

return
_Hor11; }


set
{ _Hor11 =

value
; }}


private



string
_Hor20;


public



string
hor20{


get
{

return
_Hor20; }


set
{ _Hor20 =

value
; }}


private



string
_Hor21;


public



string
hor21{


get
{

return
_Hor21; }


set
{ _Hor21 =

value
; }}


}

2 réponses

ricklekebekoi Messages postés 303 Date d'inscription mardi 11 février 2003 Statut Membre Dernière intervention 24 avril 2009 5
5 juil. 2007 à 02:04
je promet rien, sachant que je fait sa sans test et sans outil

const string maString = "090012001400190009001200140019000900120014001900090012001400190009001200140019000900120014001900
";
const int nbJour = 7;
const int nbPeriode = 2;
const int lengthBlock = 4;
string[,] maTable = new string[nbJour,nbPeriode];
if( maString.Length != (nbJour*nbPeriode*lengthBlock) )
   MessageBox.Show("Impossible!!");
else
{
   for( int i = 0; i < nbJour; ++i )
      for( int j = 0; j < nbPeriode; ++j )
         maTable[i,j] = maString.SubString((i*lengthBlock*nbPeriode)+(j*lengthBlock), lengthBlock);
}

Eric
0
ricklekebekoi Messages postés 303 Date d'inscription mardi 11 février 2003 Statut Membre Dernière intervention 24 avril 2009 5
5 juil. 2007 à 02:06
Ensuite tu l'utilise:

lundi matin: maTable[0,0]
jeudi PM: maTable[3,1]

Eric
0
Rejoignez-nous