Cannot initialize array of chars (System.TypeLoadException)

  • Thread starter Thread starter DC
  • Start date Start date
D

DC

Hi,

I am programming a windows service and all went well until I needed to
use a simple array of chars which I initialize like this:

char[] test = new char[2] {'\x002F', '\x005E'};

Immediatly upon starting the service with this line in code (long
before this line is even being used) I get a System.TypeLoadException
which I cannot debug since it seems to happen somwhere deep in the
..Net dust.

Any clue? Thanks for any suggestion,

Regards

DC
 
Thanks Tu-Thach! Although your syntax is only a short form of the
declaration (if the online help is right), it does not produce the
exception. BTW:

char[] test = new char[2] {'\x002F', '\x005E'};

and

char[] test = new char[] {'\x002F', '\x005E'};

both produced the typeloadexception.

Best regards

DC

Tu-Thach said:
char[] test = {'\x002F', '\x005E'};

Tu-Thach
-----Original Message-----
Hi,

I am programming a windows service and all went well until I needed to
use a simple array of chars which I initialize like this:

char[] test = new char[2] {'\x002F', '\x005E'};

Immediatly upon starting the service with this line in code (long
before this line is even being used) I get a System.TypeLoadException
which I cannot debug since it seems to happen somwhere deep in the
..Net dust.

Any clue? Thanks for any suggestion,

Regards

DC
.
 
Back
Top