Search code examples
c#arraysvisual-studio-2010.net-micro-framework

Is there a more efficient way of flushing an array in NetMF?


I have an array over 4000 bytes long, and am currently experiencing performance/speed issues with the following method:

public static void FlushThisArray(byte[]Array)
{
    for(int i=0;i<Array.Length;i++)
    {
        Array[i]=0;
    }
}

I have also seen the way there is a .Flush() Method in NetMF, but seems to also have performance issues?

Anyone know of any better ways of clearing this array?


Solution

  • Just do Array.Clear(myArray, 0, myArray.Length)

    [Edit: Changed link to reference .NET Micro Framework documentation.]