Bonjour,
J'ai un problème lorsque j'utilise BerConverter.Decode

La fonction lève l'exception suivante:
La chaîne "format" contient un caractère non valide.
Je ne comprend pas ou est le problème vu que j'utilise la même chaine de format à l'encodage.

Voici mon code de test:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
void MonTest() {
   try {
         string strTest="Données Encodées";
         string strDecoded="";
         byte[] byteData= Encoding.ASCII.GetBytes(strTest);
         byte[] encodedData= BerConverter.Encode("{o}", byteData);
         object[] objDataDecoded=BerConverter.Decode("{o}",encodedData);
        if ( objDataDecoded.Length !=0) {
            strDecoded=(string)objDataDecoded[0];
         }
      } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
      }
}
Merci de m'aider.