Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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 || lInt32.MaxValue || l
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MergablePropertyAttribute.cs
- QuadTree.cs
- SqlClientMetaDataCollectionNames.cs
- AsyncCodeActivityContext.cs
- SerializationInfo.cs
- SqlSelectStatement.cs
- Msec.cs
- DataGridViewImageCell.cs
- _ScatterGatherBuffers.cs
- ConfigurationPropertyCollection.cs
- ElementHostPropertyMap.cs
- LayoutManager.cs
- RawKeyboardInputReport.cs
- IncrementalCompileAnalyzer.cs
- WindowsTab.cs
- RenderData.cs
- TextSpan.cs
- CancelEventArgs.cs
- SchemaObjectWriter.cs
- MsdtcClusterUtils.cs
- Attributes.cs
- Schema.cs
- SizeChangedInfo.cs
- ToolStripSettings.cs
- ProfileGroupSettings.cs
- OperatingSystem.cs
- OdbcDataAdapter.cs
- HttpVersion.cs
- FileStream.cs
- Flattener.cs
- SignedXml.cs
- OperationGenerator.cs
- FieldBuilder.cs
- MultiPropertyDescriptorGridEntry.cs
- Exceptions.cs
- CommentAction.cs
- DataSpaceManager.cs
- ContainerUIElement3D.cs
- FileSystemWatcher.cs
- DataAdapter.cs
- LockCookie.cs
- Inline.cs
- MissingManifestResourceException.cs
- UndirectedGraph.cs
- ListViewAutomationPeer.cs
- TreeNodeMouseHoverEvent.cs
- SqlProviderManifest.cs
- RelatedImageListAttribute.cs
- BuildProviderAppliesToAttribute.cs
- UIInitializationException.cs
- ToolStripEditorManager.cs
- TimeoutTimer.cs
- Color.cs
- Localizer.cs
- TreeViewCancelEvent.cs
- AddingNewEventArgs.cs
- ScrollContentPresenter.cs
- CssClassPropertyAttribute.cs
- PublishLicense.cs
- IntSecurity.cs
- _PooledStream.cs
- DateTimeOffsetStorage.cs
- NamedPipeAppDomainProtocolHandler.cs
- ImageClickEventArgs.cs
- Model3D.cs
- DoubleCollectionConverter.cs
- OrderedEnumerableRowCollection.cs
- XmlStringTable.cs
- DownloadProgressEventArgs.cs
- NullRuntimeConfig.cs
- PassportIdentity.cs
- TaskSchedulerException.cs
- TreeViewImageKeyConverter.cs
- X509ChainElement.cs
- NamespaceQuery.cs
- TearOffProxy.cs
- IsolatedStorageFilePermission.cs
- FileEnumerator.cs
- DecoderNLS.cs
- TextElementEnumerator.cs
- SqlUserDefinedAggregateAttribute.cs
- EpmContentDeSerializerBase.cs
- ListViewItemMouseHoverEvent.cs
- NamedObject.cs
- SmiMetaDataProperty.cs
- ProtectedConfigurationSection.cs
- StandardCommands.cs
- SoapEnumAttribute.cs
- AffineTransform3D.cs
- VisualStyleRenderer.cs
- CompilerParameters.cs
- TopClause.cs
- CopyOfAction.cs
- GlyphRun.cs
- DataServiceEntityAttribute.cs
- ImageMetadata.cs
- SqlCrossApplyToCrossJoin.cs
- ForEachAction.cs
- WebResourceAttribute.cs
- XamlTemplateSerializer.cs