zoukankan      html  css  js  c++  java
  • C++和C#数据类型转换(常用)

    C++ C#
    HANDLE(void *) System.IntPtr
    Byte(unsigned char) System.Byte
    SHORT(short) System.Int16
    WORD(unsigned short) System.Int16
    INT(int) System.Int16 System.Int32
    UINT(unsigned int) System.Int16 System.Int32
    LONG(long) System.Int32
    ULONG(unsigned long) System.UInt32
    CHAR(char) System.Char
    BOOL bool
    LPSTR System.string
    LPWSTR System.string
    LPCSTR System.string
    LPCWSTR System.string
       
    结构体 public struct 结构体{}
    结构体 **变量名 out 变量名
    结构体 &变量名 ref 变量名
    C++ C#
    UCHAR int
    UCHAR byte
    UCHAR* string
    UCHAR* IntPtr
    Handle IntPtr
    COLORREF uint
    unsigned char byte
    unsigned char* ref byte
     

    [MarshalAs(UnmanagedType.LpArray)] byte[]

     

    [MarshalAs(UnmanagedType.LpArray)] IntPtr

    unsigned char& ref byte
    unsigned char变量名 byte 变量名
    unsigned short变量名 short 变量名
    unsigned int变量名 uint 变量名
    unsigned long变量名 ulong 变量名
    unsigned char变量名 byte 变量名
    C++ C#
    char 数组名[数组大小]

    [MarshalAs(UnmanagedType.ByValTStr,SizeConst=数组大小)]

    public string 数组名

       
       
    char* string
    cons char* string 
    char[] string
       
    传入参数  
    char & stringBuilder
    传出参数  
    char * ref string
       
    handle IntPtr
    hwnd IntPtr
    void* IntPtr
  • 相关阅读:
    文件系统类型
    Linux VFS分析(二)
    VFS(Virtual File System)
    shell语言
    linux VFS 之一 :虚拟文件系统的面向对象设计思想
    分层利器 facade
    微内核与面向组件
    从操作系统内核看设计模式--linux内核的facade模式
    软件架构模式
    联系的度量
  • 原文地址:https://www.cnblogs.com/DannyShi/p/4604819.html
Copyright © 2011-2022 走看看