I would like to translate this piece of code from C# to Powershell.
static unsafe void Copy(IntPtr source, int sourceOffset, IntPtr destination, int destinationOffset, int count)
{
byte* src = (byte*)source + sourceOffset;
byte* dst = (byte*)destination + destinationOffset;
byte* end = dst + count;
while (dst != end)
*dst++ = *src++;
}
I' dont know how to deal with pointers in Powershell Can anybody help me?
Add-Type(with-CompilerParametersto pass/unsafeto compile unsafe code), but there's possibly a better solution that requires no unsafe code at all. (For completeness: PowerShell has no native pointer types.)