// Use this when the unmanaged API expects the structure passed by-value, or
// or if you want to pass it by-reference as a pointer to a structure
struct OSVERSIONINFO {
public int OSVersionInfoSize;
[ MarshalAs( UnmanagedType.ByValTStr, SizeConst=128 )]
public String versionString;
}
// Use this when you want to pass it by-value even though the unmanaged API
// expects a pointer to a structure. Being a class adds an extra level of indirection.
[StructLayout(LayoutKind.Sequential)]
class OSVERSIONINFO
{
public int OSVersionInfoSize;
[ MarshalAs( UnmanagedType.ByValTStr, SizeConst=128 )]
public String versionString;
}
' Use this when the unmanaged API expects the structure passed by-value, or
' or if you want to pass it by-reference as a pointer to a structure
Structure OSVERSIONINFO
Public OSVersionInfoSize As Integer
< MarshalAs( UnmanagedType.ByValTStr, SizeConst=128 )> _
Public versionString As String
End Structure
' Use this when you want to pass it by-value even though the unmanaged API
' expects a pointer to a structure. Being a class adds an extra level of indirection.
<StructLayout(LayoutKind.Sequential)> _
Class OSVERSIONINFO
Public OSVersionInfoSize As Integer
< MarshalAs( UnmanagedType.ByValTStr, SizeConst=128 )> _
Public versionString As String
End Class
None.