Cannot initialize array of chars (System.TypeLoadException)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DC

    #1

    Cannot initialize array of chars (System.TypeLoadException)

    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.TypeLoad Exception
    which I cannot debug since it seems to happen somwhere deep in the
    ..Net dust.

    Any clue? Thanks for any suggestion,

    Regards

    DC
  • DC

    #2
    Re: Cannot initialize array of chars (System.TypeLoa dException)

    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 typeloadexcepti on.

    Best regards

    DC

    "Tu-Thach" <tuthach@yahoo. com> wrote in message news:<0f3f01c35 131$cd5430c0$a4 01280a@phx.gbl> ...[color=blue]
    > char[] test = {'\x002F', '\x005E'};
    >
    > Tu-Thach
    >[color=green]
    > >-----Original Message-----
    > >Hi,
    > >
    > >I am programming a windows service and all went well[/color]
    > until I needed to[color=green]
    > >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[/color]
    > code (long[color=green]
    > >before this line is even being used) I get a[/color]
    > System.TypeLoad Exception[color=green]
    > >which I cannot debug since it seems to happen somwhere[/color]
    > deep in the[color=green]
    > >..Net dust.
    > >
    > >Any clue? Thanks for any suggestion,
    > >
    > >Regards
    > >
    > >DC
    > >.
    > >[/color][/color]

    Comment

    Working...