Export (0) Print
Expand All

Marshal.ReadInt64 Method (Object, Int32)

.NET Framework 1.1

Reads a 64-bit signed integer from unmanaged memory.

[Visual Basic]
Overloads Public Shared Function ReadInt64( _
   <InteropServices.In()> ByVal ptr As Object, _
   ByVal ofs As Integer _
) As Long
public static long ReadInt64(
] object ptr,
 int ofs
public: static __int64 ReadInt64(
] Object* ptr,
 int ofs
public static function ReadInt64(
   ptr : Object,
 ofs : int
) : long;


The base address in unmanaged memory of the source object.
An additional byte offset, added to the ptr parameter before reading.

Return Value

The 64-bit signed integer read from the ptr parameter.


Exception Type Condition
ArgumentException ptr is not a recognized format.


ReadInt64 enables direct interaction with an unmanaged 64-bit signed array, eliminating the expense of copying an entire unmanaged array (using Marshal.Copy) to a separate managed array before reading its element values.

Note   This method uses SecurityAction.LinkDemand to prevent it from being called from untrusted code; only the immediate caller is required to have SecurityPermissionAttribute.UnmanagedCode permission. If your code can be called from partially trusted code, do not pass user input to Marshal class methods without validation. For important limitations on using the LinkDemand member, see Demand vs. LinkDemand.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Marshal Class | Marshal Members | System.Runtime.InteropServices Namespace | Marshal.ReadInt64 Overload List | Copy

© 2014 Microsoft