Thanks.
"Jon Skeet [C# MVP]" wrote:
> ValyaS <ValyaS@discussions.microsoft.com> wrote:
> > I have a byte array (myArray) filled by reading bytes from the Com port. And
> > I need to check for a termination byte (0x00 or "\0") as well as for a
> > combination of bytes/ASCII characters (myString).
> >
> > I have to provide best possible performance.
> >
> > I'm wunderring if there is any internal boxing involved in the statements
> > like the following:
> >
> > byte myByte = 0x00;
> > if (Array.LastIndexOf(myArray, myByte) >= 0)
> > ...
>
> Yes, that involves boxing because the parameter type is object.
>
> > String sbuffer = Encoding.ASCII.GetString(myArray, 0, cnt);
> > if (sbuffer.LastIndexOf(myString) >= 0)
> > ...
>
> There's no boxing in that bit.
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too