There are some more answers on this (duplicate?) question: What is the equivalent of memset in C#?
Someone has benchmarked the alternatives (they included an unsafe version, but they didn't try memset
): http://techmikael.blogspot.co.uk/2009/12/filling-array-with-default-value.html