Possible Duplicate:
C# memcpy equivalent
What is the equivalent of the memcpy
function in c#?
Possible Duplicate:
C# memcpy equivalent
What is the equivalent of the memcpy
function in c#?
Buffer.BlockCopy
is close, but limited to arrays. I agree it depends what you're trying to do.
As already said it depends what you are trying to do... So you can consider one of these... check the links:
There may be other possible options based on your needs...
For copying (byte) arrays, you can use the Array.Copy() method, but that's probably not what you want:
byte[] array1 = new byte[10] { 1,2,3,4,5,6,7,8,9,10 };
byte[] array2 = new byte[10];
Array.Copy(array1,array2,10);
There is none. C# protects the actual memory behind several layers of abstraction. For some purposes, the IClonable
interface may be of some help though.
You can use unsafe
and pointers. But your particular case would say a bit more about what direction you should head.