Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / IntPtr.cs / 1 / IntPtr.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: IntPtr
**
**
** Purpose: Platform independent integer
**
**
===========================================================*/
namespace System {
using System;
using System.Globalization;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct IntPtr : ISerializable
{
unsafe private void* m_value; // The compiler treats void* closest to uint hence explicit casts are required to preserve int behavior
public static readonly IntPtr Zero;
// fast way to compare IntPtr to (IntPtr)0 while IntPtr.Zero doesn't work due to slow statics access
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal unsafe bool IsNull()
{
return (this.m_value == null);
}
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe IntPtr(int value)
{
#if WIN32
m_value = (void *)value;
#else
m_value = (void *)(long)value;
#endif
}
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe IntPtr(long value)
{
#if WIN32
m_value = (void *)checked((int)value);
#else
m_value = (void *)value;
#endif
}
[CLSCompliant(false)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe IntPtr(void* value)
{
m_value = value;
}
private unsafe IntPtr(SerializationInfo info, StreamingContext context) {
long l = info.GetInt64("value");
if (Size==4 && (l>Int32.MaxValue || l
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MetaColumn.cs
- FormViewPageEventArgs.cs
- SetState.cs
- AutomationPatternInfo.cs
- DataGridDetailsPresenter.cs
- ProbeRequestResponseAsyncResult.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- GenericTextProperties.cs
- MenuEventArgs.cs
- FixUpCollection.cs
- Int64AnimationBase.cs
- MailMessageEventArgs.cs
- SharedConnectionWorkflowTransactionService.cs
- AssemblyAttributesGoHere.cs
- PermissionListSet.cs
- PathBox.cs
- SqlTriggerAttribute.cs
- ControlPropertyNameConverter.cs
- UnknownBitmapEncoder.cs
- PageTheme.cs
- FormsAuthentication.cs
- XPathNodeIterator.cs
- TemplatePartAttribute.cs
- LinkButton.cs
- ColorConverter.cs
- MTConfigUtil.cs
- ByteFacetDescriptionElement.cs
- Stylesheet.cs
- FormViewRow.cs
- RelationalExpressions.cs
- ProtectedProviderSettings.cs
- ErrorProvider.cs
- UnsafeNativeMethods.cs
- SafeRegistryKey.cs
- AttachedPropertyMethodSelector.cs
- DataGridLength.cs
- QueryContinueDragEvent.cs
- MatrixKeyFrameCollection.cs
- DesignerTransactionCloseEvent.cs
- ClrPerspective.cs
- KeyNotFoundException.cs
- _AutoWebProxyScriptEngine.cs
- TimeEnumHelper.cs
- CommonDialog.cs
- ProfileEventArgs.cs
- GridView.cs
- SudsWriter.cs
- OleDbCommand.cs
- MessageSecurityOverMsmqElement.cs
- DoubleLinkList.cs
- TreeBuilderBamlTranslator.cs
- MessageSmuggler.cs
- DataTableNewRowEvent.cs
- SoapReflectionImporter.cs
- ImageMap.cs
- UrlMapping.cs
- OleDbConnection.cs
- EndpointConfigContainer.cs
- ContentType.cs
- DataContractJsonSerializer.cs
- PermissionListSet.cs
- EmptyTextWriter.cs
- SinglePageViewer.cs
- PathBox.cs
- WindowsComboBox.cs
- BroadcastEventHelper.cs
- SiteMapDataSource.cs
- SafeProcessHandle.cs
- PngBitmapDecoder.cs
- EastAsianLunisolarCalendar.cs
- MainMenu.cs
- DataGridViewUtilities.cs
- RelationshipDetailsRow.cs
- FolderBrowserDialog.cs
- HttpInputStream.cs
- CalendarAutomationPeer.cs
- ObjectSet.cs
- PrivateFontCollection.cs
- VirtualStackFrame.cs
- Overlapped.cs
- PipeStream.cs
- PrimitiveList.cs
- IgnoreSectionHandler.cs
- ImageFormatConverter.cs
- ReferencedAssembly.cs
- SqlProvider.cs
- DrawingBrush.cs
- TimeSpanOrInfiniteConverter.cs
- ComponentDesigner.cs
- EmptyEnumerator.cs
- GlyphManager.cs
- NavigationCommands.cs
- Compensation.cs
- GeneralTransform.cs
- Lease.cs
- DataServiceEntityAttribute.cs
- WaitForChangedResult.cs
- SystemFonts.cs
- ParameterToken.cs
- __Filters.cs