Export (0) Print
Expand All

Marshal.Copy Method

Copies data from a managed array to an unmanaged memory pointer.

Overload List

Copies data from a one-dimensional, managed 8-bit unsigned integer array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Byte(), Integer, IntPtr, Integer)
[C#] public static void Copy(byte[], int, IntPtr, int);
[C++] public: static void Copy(unsigned char __gc[], int, IntPtr, int);
[JScript] public static function Copy(Byte[], int, IntPtr, int);

Copies data from a one-dimensional, managed character array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Char(), Integer, IntPtr, Integer)
[C#] public static void Copy(char[], int, IntPtr, int);
[C++] public: static void Copy(__wchar_t __gc[], int, IntPtr, int);
[JScript] public static function Copy(Char[], int, IntPtr, int);

Copies data from a one-dimensional, managed double-precision floating-point number array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Double(), Integer, IntPtr, Integer)
[C#] public static void Copy(double[], int, IntPtr, int);
[C++] public: static void Copy(double __gc[], int, IntPtr, int);
[JScript] public static function Copy(double[], int, IntPtr, int);

Copies data from a one-dimensional, managed 16-bit signed integer array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Short(), Integer, IntPtr, Integer)
[C#] public static void Copy(short[], int, IntPtr, int);
[C++] public: static void Copy(short __gc[], int, IntPtr, int);
[JScript] public static function Copy(Int16[], int, IntPtr, int);

Copies data from a one-dimensional, managed 32-bit signed integer array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Integer(), Integer, IntPtr, Integer)
[C#] public static void Copy(int[], int, IntPtr, int);
[C++] public: static void Copy(int __gc[], int, IntPtr, int);
[JScript] public static function Copy(int[], int, IntPtr, int);

Copies data from a one-dimensional, managed 64-bit signed integer array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Long(), Integer, IntPtr, Integer)
[C#] public static void Copy(long[], int, IntPtr, int);
[C++] public: static void Copy(__int64 __gc[], int, IntPtr, int);
[JScript] public static function Copy(long[], int, IntPtr, int);

Copies data from an unmanaged memory pointer to a managed 8-bit unsigned integer array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Byte(), Integer, Integer)
[C#] public static void Copy(IntPtr, byte[], int, int);
[C++] public: static void Copy(IntPtr, unsigned char __gc[], int, int);
[JScript] public static function Copy(IntPtr, Byte[], int, int);

Copies data from an unmanaged memory pointer to a managed character array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Char(), Integer, Integer)
[C#] public static void Copy(IntPtr, char[], int, int);
[C++] public: static void Copy(IntPtr, __wchar_t __gc[], int, int);
[JScript] public static function Copy(IntPtr, Char[], int, int);

Copies data from an unmanaged memory pointer to a managed double-precision floating-point number array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Double(), Integer, Integer)
[C#] public static void Copy(IntPtr, double[], int, int);
[C++] public: static void Copy(IntPtr, double __gc[], int, int);
[JScript] public static function Copy(IntPtr, double[], int, int);

Copies data from an unmanaged memory pointer to a managed 16-bit signed integer array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Short(), Integer, Integer)
[C#] public static void Copy(IntPtr, short[], int, int);
[C++] public: static void Copy(IntPtr, short __gc[], int, int);
[JScript] public static function Copy(IntPtr, Int16[], int, int);

Copies data from an unmanaged memory pointer to a managed 32-bit signed integer array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Integer(), Integer, Integer)
[C#] public static void Copy(IntPtr, int[], int, int);
[C++] public: static void Copy(IntPtr, int __gc[], int, int);
[JScript] public static function Copy(IntPtr, int[], int, int);

Copies data from an unmanaged memory pointer to a managed 64-bit signed integer array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Long(), Integer, Integer)
[C#] public static void Copy(IntPtr, long[], int, int);
[C++] public: static void Copy(IntPtr, __int64 __gc[], int, int);
[JScript] public static function Copy(IntPtr, long[], int, int);

Copies data from an unmanaged memory pointer to a managed single-precision floating-point number array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(IntPtr, Single(), Integer, Integer)
[C#] public static void Copy(IntPtr, float[], int, int);
[C++] public: static void Copy(IntPtr, float __gc[], int, int);
[JScript] public static function Copy(IntPtr, float[], int, int);

Copies data from a one-dimensional, managed single-precision floating-point number array to an unmanaged memory pointer.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Copy(Single(), Integer, IntPtr, Integer)
[C#] public static void Copy(float[], int, IntPtr, int);
[C++] public: static void Copy(float __gc[], int, IntPtr, int);
[JScript] public static function Copy(float[], int, IntPtr, int);

Example

[Visual Basic, C#] The following example demonstrates how to copy a one-dimensional array to an unmanaged memory pointer.

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of Copy. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Overloads Shared Sub Copy(source As Single(), _
  startIndex As Integer, destination As IntPtr, length As Integer)
      
[C#] 
public static void Copy(float[] source, int startIndex, 
  IntPtr destination, int length);
      

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Marshal Class | Marshal Members | System.Runtime.InteropServices Namespace

Show:
© 2014 Microsoft