I'm converting to VB.NET, which doesn't provide the unchecked
keyword. But it appears to be unnecessary in this statement:
const int dwAccess = unchecked((int)0xC0000000);
I have two observations here:
dwAccess
is declared as a constant- The value assigned falls well within the range of
System.Int32
Given these, will it be safe to just go with this:
Const dwAccess As Integer = &HC0000000
It's being used in this context:
[DllImport("Kernel32", CharSet = CharSet.Auto, SetLastError = true)]
private static extern SafeFileHandle CreateFile(string lpFileName, int dwAccess, int dwShareMode,
IntPtr securityAttrs, int dwCreationDisposition,
int dwFlagsAndAttributes, IntPtr hTemplateFile);
Clarification: This question is not about whether the unchecked
keyword is necessary in C#. Clearly it is. It's about whether the absence of the keyword in VB.NET precludes successful conversion of the statement.