zoukankan      html  css  js  c++  java
  • [Tip: C# intptr]Intptr VS int

    C# contains a struct called Intptr, which aims to be the same position as void* in unmanaged world. So it will be 32bit on x32 hardware and OS and be 64bit on x63 platform. So be careful about misusing it with int. Int keeps 4 bytes on any platform.

    MOre:

    1. 在您调用的API函数中一定有类似窗体句柄这样的参数,那么当您声明这个函数时,您应该将它显式地声明为IntPtr类型。 在C#中声明Win32API时,一定要按照WinAPI的原型来声明,不要改变它的数据类型.

    2. IntPtr   类型被设计成整数,其大小适用于特定平台。即是说,此类型的实例在32位硬件和操作系统中将是32位,在64位硬件和操作系统上将是64 位. IntPtr类型可以由支持指针的语言使用,并可作为在支持与不支持指针的语言间引用数据的一种通用方式。IntPtr对象也可用于保持句柄。例如,IntPtr   的实例广泛地用在   System.IO.FileStream   类中来保持文件句柄。  

    参考: http://twt716.blog.163.com/blog/static/320645352009329529191/


  • 相关阅读:
    Spark2 Dataset DataFrame空值null,NaN判断和处理
    Spark2 文件处理和jar包执行
    &与&&, |与||区别
    Scala实现乘法口诀
    Hive desc
    Hive FUNCTIONS函数
    Hive show
    MySQL行列转换拼接
    MySQL字符串连接
    SQLServer之索引简介
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1862473.html
Copyright © 2011-2022 走看看