Método Marshal.Copy (IntPtr, IntPtr[], Int32, Int32)
Publicado: agosto de 2016
Dica
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.
Copia os dados de um ponteiro de memória não gerenciada em uma matriz gerenciada IntPtr.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (em mscorlib.dll)
Sintaxe
[SecurityCriticalAttribute]
public static void Copy(
IntPtr source,
IntPtr[] destination,
int startIndex,
int length
)
public:
[SecurityCriticalAttribute]
static void Copy(
IntPtr source,
array<IntPtr>^ destination,
int startIndex,
int length
)
[<SecurityCriticalAttribute>]
static member Copy :
source:nativeint *
destination:nativeint[] *
startIndex:int *
length:int -> unit
<SecurityCriticalAttribute>
Public Shared Sub Copy (
source As IntPtr,
destination As IntPtr(),
startIndex As Integer,
length As Integer
)
Parâmetros
source
Type: System.IntPtrO ponteiro de memória do qual copiar.
destination
Type: System.IntPtr[]A matriz para a qual copiar.
startIndex
Type: System.Int32O índice baseado em zero na matriz de destino em que a cópia deve iniciar.
length
Type: System.Int32O número de elementos da matriz a copiar.
Exceções
Exception | Condition |
---|---|
ArgumentNullException | source, destination, startIndex ou length é null. |
Comentários
Não gerenciados, matrizes de estilo C não contêm informações de limites, o que impede que o startIndex e length parâmetros sejam validados. Portanto, os dados não gerenciados que corresponde do source parâmetro preenche a matriz gerenciada, independentemente de sua utilidade. Você deve inicializar a matriz gerenciada com o tamanho apropriado antes de chamar o Marshal.Copy método.
Segurança
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Informações de Versão
Plataforma Universal do Windows
Disponível desde 8
.NET Framework
Disponível desde 2.0
Biblioteca de Classes Portátil
Com suporte no: plataformas portáteis do .NET
Windows Phone
Disponível desde 8.1
Confira Também
Copy Sobrecarga
Classe Marshal
Namespace System.Runtime.InteropServices
Retornar ao início