RedimStatement de VB en Csharp
Bonjour,
Je bloque sur la conversion d'un code VB en Csharp. Le code redimensionne des tableaux.
Extrait du code VB:
Code:
1 2 3 4 5 6 7 8 9
| Dim oMarketsReq As New BFUK.GetAllMarketsReq
Dim oMarketsResp As BFUK.GetAllMarketsResp
With oMarketsReq
.header = oHeaderUK()
ReDim .eventTypeIds(0) : .eventTypeIds(0) = 7
ReDim .countries(1) : .countries(0) = "GBR" : .countries(1) = "ZAF"
.fromDate = Today
.toDate = Today.AddDays(1)
End With |
Code convertit en Csharp:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| BFUK.GetAllMarketsReq oMarketsReq = new BFUK.GetAllMarketsReq();
BFUK.GetAllMarketsResp oMarketsResp = default(BFUK.GetAllMarketsResp);
{
oMarketsReq.header = oHeaderUK();
// ERROR: Not supported in C: ReDimStatement
oMarketsReq.eventTypeIds[0] = 7;
// ERROR: Not supported in C: ReDimStatement
oMarketsReq.countries[0] = "GBR";
oMarketsReq.countries[1] = "ZAF";
oMarketsReq.fromDate = DateTime.Now;
oMarketsReq.toDate = DateTime.Now.AddDays(1);
} |
J'obtiens évidement une NullReferenceException pour eventTypeIds et countries.
Comment dois-je m'y prendre sachant que je ne suis guère familier avec l'utilisation des arrays?
Merci.