Is there any equivalent to memset?

  • Thread starter Thread starter ThunderMusic
  • Start date Start date
T

ThunderMusic

Hi,
I want to know if there is an equivalent to memset but in .NET. I know there
is System.Buffer.SetByte, but it only works on arrays. I have a structure
and in some example codes I found, they initialize this structure to zero
with memset like this to make sure not garbage is taken from the memory not
being erased properly :

TheStruct StructVar;
memset (StructVar, 0, sizeof(StructVar));

Is there an equivalent or simply I don't have to do that anymore in .NET?

Thanks

ThunderMusic
 
The default parameterless constructor of the structure should set
everything to its default values, which should be equivalent to
ZeroMemory.
 
Back
Top