0

I am trying to convert a big byte array of zeros and one to a string variable.

private Random _random;
private string _str;

private void Convert(byte[] bytes)
{
    for (var index = 0; index < 10000000; index++)
    {
        var b = bytes[index];                
        _str += b.ToString();

    }            
}

But its performance is very low.

Is it possible to convert a big array to string variable with 'unsafe' or 'fixed' keywords? (use memory allocation)

Milad Hatami
  • 1,494
  • 13
  • 18

0 Answers0