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
- MetadataArtifactLoaderXmlReaderWrapper.cs
- DataBinder.cs
- LineSegment.cs
- StandardCommands.cs
- ProfileModule.cs
- RefreshEventArgs.cs
- TemplateParser.cs
- EdmToObjectNamespaceMap.cs
- WindowCollection.cs
- ProbeDuplex11AsyncResult.cs
- DataMember.cs
- Vector3D.cs
- ISessionStateStore.cs
- BulletDecorator.cs
- RichTextBoxAutomationPeer.cs
- XmlNavigatorStack.cs
- DataGridSortCommandEventArgs.cs
- RowSpanVector.cs
- Material.cs
- KeyedCollection.cs
- HtmlElementEventArgs.cs
- IntPtr.cs
- TableHeaderCell.cs
- CodeMethodReturnStatement.cs
- HtmlFormAdapter.cs
- CodeTypeMemberCollection.cs
- NativeMethods.cs
- safesecurityhelperavalon.cs
- ResourcePart.cs
- ErrorRuntimeConfig.cs
- DataBoundControlHelper.cs
- ConfigXmlCDataSection.cs
- FormViewModeEventArgs.cs
- TcpTransportElement.cs
- FolderLevelBuildProviderCollection.cs
- List.cs
- ObjectHandle.cs
- HitTestFilterBehavior.cs
- Deflater.cs
- RepeatInfo.cs
- x509store.cs
- AsyncCompletedEventArgs.cs
- ReflectionServiceProvider.cs
- SqlProcedureAttribute.cs
- DisableDpiAwarenessAttribute.cs
- X509CertificateChain.cs
- PictureBox.cs
- BaseCAMarshaler.cs
- SiteMapNodeItem.cs
- CustomCredentialPolicy.cs
- AdornerLayer.cs
- RenderingEventArgs.cs
- DataControlFieldTypeEditor.cs
- OperationResponse.cs
- ArgIterator.cs
- ProfileService.cs
- PieceNameHelper.cs
- SmtpNegotiateAuthenticationModule.cs
- EditorZoneAutoFormat.cs
- WebPartChrome.cs
- SpellerStatusTable.cs
- String.cs
- ImmutableObjectAttribute.cs
- EncodingTable.cs
- OneOfConst.cs
- DesignTimeSiteMapProvider.cs
- ScriptingJsonSerializationSection.cs
- SerialPort.cs
- CriticalExceptions.cs
- LayoutTableCell.cs
- FixedSOMPageConstructor.cs
- RoutedEvent.cs
- UpdateProgress.cs
- StorageComplexPropertyMapping.cs
- GenericUriParser.cs
- MatrixConverter.cs
- GroupQuery.cs
- SymbolEqualComparer.cs
- DecoderFallback.cs
- UpdateTracker.cs
- GenerateScriptTypeAttribute.cs
- BufferModesCollection.cs
- StringToken.cs
- SafeHandles.cs
- ModifierKeysConverter.cs
- XPathNodeHelper.cs
- PixelFormats.cs
- QueryExpression.cs
- ObjectTypeMapping.cs
- RMEnrollmentPage3.cs
- Crc32.cs
- Tablet.cs
- RadioButtonFlatAdapter.cs
- ColumnHeader.cs
- ExecutorLocksHeldException.cs
- XmlSchemaInclude.cs
- MediaElementAutomationPeer.cs
- DesignTimeParseData.cs
- StateWorkerRequest.cs
- FormConverter.cs