{
checked
{
- IntPtr intPtrArray = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)) * size);
+ IntPtr intPtrArray = Marshal.AllocHGlobal(IntPtr.Size * size);
for (int i = 0; i < size; i++)
{
- IntPtr tempPtr = (IntPtr)((long)intPtrArray + Marshal.SizeOf(typeof(IntPtr)) * i);
+ IntPtr tempPtr = (IntPtr)((long)intPtrArray + IntPtr.Size * i);
Marshal.WriteIntPtr(tempPtr, IntPtr.Zero);
}
return intPtrArray;
managedControls[i].ldctl_value = new berval
{
bv_len = byteControlValue.Length,
- bv_val = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * byteControlValue.Length)
+ bv_val = Marshal.AllocHGlobal(sizeof(byte) * byteControlValue.Length)
};
Marshal.Copy(byteControlValue, 0, managedControls[i].ldctl_value.bv_val, managedControls[i].ldctl_value.bv_len);
}
{
if (advanced)
{
- addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_ATTR_META_DATA_2)));
+ addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_ATTR_META_DATA_2)));
AttributeMetadata managedMetaData = new AttributeMetadata(addr, true, _server, _nameTable);
Add(managedMetaData.Name, managedMetaData);
}
else
{
- addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_ATTR_META_DATA)));
+ addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_ATTR_META_DATA)));
AttributeMetadata managedMetaData = new AttributeMetadata(addr, false, _server, _nameTable);
Add(managedMetaData.Name, managedMetaData);
{
if (advanced)
{
- addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3)));
+ addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR_3)));
DS_REPL_CURSOR_3 cursor = new DS_REPL_CURSOR_3();
Marshal.PtrToStructure(addr, cursor);
}
else
{
- addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR)));
+ addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_CURSOR)));
DS_REPL_CURSOR cursor = new DS_REPL_CURSOR();
Marshal.PtrToStructure(addr, cursor);
for (int i = 0; i < count; i++)
{
- addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_KCC_DSA_FAILURE)));
+ addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_KCC_DSA_FAILURE)));
ReplicationFailure managedFailure = new ReplicationFailure(addr, _server, _nameTable);
for (int i = 0; i < count; i++)
{
- addr = IntPtr.Add(info, Marshal.SizeOf(typeof(int)) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_NEIGHBOR)));
+ addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf(typeof(DS_REPL_NEIGHBOR)));
ReplicationNeighbor managedNeighbor = new ReplicationNeighbor(addr, _server, _nameTable);
int size = Marshal.SizeOf(typeof(EncoderParameter));
int length = _param.Length;
- IntPtr memory = Marshal.AllocHGlobal(checked(length * size + Marshal.SizeOf(typeof(IntPtr))));
+ IntPtr memory = Marshal.AllocHGlobal(checked(length * size + IntPtr.Size));
Marshal.WriteIntPtr(memory, (IntPtr)length);
- long arrayOffset = checked((long)memory + Marshal.SizeOf(typeof(IntPtr)));
+ long arrayOffset = checked((long)memory + IntPtr.Size);
for (int i = 0; i < length; i++)
{
EncoderParameters p = new EncoderParameters(count);
int size = Marshal.SizeOf(typeof(EncoderParameter));
- long arrayOffset = (long)memory + Marshal.SizeOf(typeof(IntPtr));
+ long arrayOffset = (long)memory + IntPtr.Size;
for (int i = 0; i < count; i++)
{
// PRINTER_INFO_4 is 12 or 24 bytes in size depending on the architecture.
if (IntPtr.Size == 8)
{
- sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1) + Padding64Bit;
+ sizeofstruct = (IntPtr.Size * 2) + (sizeof(int) * 1) + Padding64Bit;
}
else
{
- sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1);
+ sizeofstruct = (IntPtr.Size * 2) + (sizeof(int) * 1);
}
int bufferSize;
HandleRef hdc = new HandleRef(dc, dc.Hdc);
try
{
- isDirectPrintingSupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0;
+ isDirectPrintingSupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, sizeof(int), ref nEscape, 0, out outData) > 0;
}
finally
{
HandleRef hdc = new HandleRef(dc, dc.Hdc);
try
{
- bool querySupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0;
+ bool querySupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, sizeof(int), ref nEscape, 0, out outData) > 0;
if (querySupported)
{
- isDirectPrintingSupported = (SafeNativeMethods.ExtEscape(hdc, nEscape, pvImageLen, pvImage, Marshal.SizeOf(typeof(int)), out outData) > 0)
+ isDirectPrintingSupported = (SafeNativeMethods.ExtEscape(hdc, nEscape, pvImageLen, pvImage, sizeof(int), out outData) > 0)
&& (outData == 1);
}
}