ZeroMemory

  • Thread starter Thread starter muriwai
  • Start date Start date
M

muriwai

Hi, I need an equivalent of ZeroMemory in c# 2.0. The below does not compile
because it cannot convert 0 to T. I plan to use the method for numeric Ts
only.

public static void Zero<T>( T[] o, int offset, int length )
{
for( int i = 0; i < length; i++ )
{
o[ offset + i ] = 0;
}
}

Thanks!
 
Never mind, both Array.Clear and { object zero = 0; ... = (T) zero; } work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Windows 10 Error: 'CreateProcessWithTokenW' was not declared in this scope 2
ZeroMemory 7
Use of event handling 6
Getting HDD Serial of C drive. 2
Method overloading 3
waveInOpen 64-bit 0
generic class 3
Expand Range into List 2

Back
Top