International System of Units (SI)

I found a quite useful overview of international system unit prefixes:

Factor Name Symbol Origin Derivation
2^10 kibi Ki kilobinary: (2^10)^1 kilo: (10^3)^1
2^20 mebi Mi megabinary: (2^10)^2 mega: (10^3)^2
2^30 gibi Gi gigabinary: (2^10)^3 giga: (10^3)^3
2^40 tebi Ti terabinary: (2^10)^4 tera: (10^3)^4
2^50 pebi Pi petabinary: (2^10)^5 peta: (10^3)^5
2^60 exbi Ei exabinary: (2^10)^6 exa: (10^3)^6

Examples and comparisons with system units prefixes

one kibibit 1 Kibit = 2^10 bit = 1024 bit
one kilobit 1 kbit = 10^3 bit = 1000 bit
one mebibyte 1 MiB = 2^20 B = 1 048 576 B
one megabyte 1 MB = 10^6 B = 1 000 000 B
one gibibyte 1 GiB = 2^30 B = 1 073 741 824 B
one gigabyte 1 GB = 10^9 B = 1 000 000 000 B

P/Invoke Data Type Matching

Creating this table took a while, but saved me hours…

Windows Data Type .NET Data Type
BOOL, BOOLEAN Boolean or Int32
BSTR String
BYTE Byte
CHAR Char
DOUBLE Double
DWORD Int32 or UInt32
FLOAT Single
HANDLE IntPtr, UintPtr or HandleRef
HRESULT Int32 or UInt32
INT Int32
LANGID Int16 or UInt16
LCID Int32 or UInt32
LONG Int32
LPARAM IntPtr, UintPtr or Object
LPCSTR String
LPCTSTR String
LPCWSTR String
LPSTR String or StringBuilder*
LPTSTR String or StringBuilder
LPWSTR String or StringBuilder
LPVOID IntPtr, UintPtr or Object
LRESULT IntPtr
SAFEARRAY .NET array type
SHORT Int16
TCHAR Char
UCHAR SByte
UINT Int32 or UInt32
ULONG Int32 or UInt32
VARIANT Object
VARIANT_BOOL Boolean
WCHAR Char
WORD Int16 or UInt16
WPARAM IntPtr, UintPtr or Object

Standard Numeric Format Strings

It usually takes ages until I find the page with the format strings on MSDN. So here’s a short overview:

C or c = Currency
D or d = Decimal
E or e = Scientific (exponential)
F or f = Fixed-point
G or g = General
N or n = Number
P or p =  Percent
R or r = Round-trip
X or x = Hexadecimal