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
- GenericPrincipal.cs
- ToolStripGrip.cs
- MimeParameter.cs
- EncryptedHeader.cs
- TargetInvocationException.cs
- UnknownWrapper.cs
- HelpInfo.cs
- XmlSubtreeReader.cs
- Reference.cs
- LambdaExpression.cs
- TextDecorationCollection.cs
- DaylightTime.cs
- ChangeInterceptorAttribute.cs
- MetaColumn.cs
- IgnorePropertiesAttribute.cs
- SafeCryptContextHandle.cs
- _LocalDataStore.cs
- SmiContext.cs
- DefaultValueMapping.cs
- PersonalizationStateInfo.cs
- DbMetaDataFactory.cs
- MultipartIdentifier.cs
- RelationshipManager.cs
- RegexCompilationInfo.cs
- RTLAwareMessageBox.cs
- GeometryModel3D.cs
- GroupBox.cs
- ViewStateException.cs
- Pipe.cs
- Typography.cs
- AddInSegmentDirectoryNotFoundException.cs
- HuffModule.cs
- HttpValueCollection.cs
- Oid.cs
- ContainerParagraph.cs
- GestureRecognizer.cs
- TcpTransportBindingElement.cs
- ToolStripItemGlyph.cs
- sortedlist.cs
- AssociatedControlConverter.cs
- ServicePoint.cs
- Regex.cs
- querybuilder.cs
- WebPartMinimizeVerb.cs
- OleDbCommand.cs
- TogglePatternIdentifiers.cs
- TableChangeProcessor.cs
- PointConverter.cs
- ConfigPathUtility.cs
- RegistryPermission.cs
- Mapping.cs
- TextDocumentView.cs
- ConfigurationStrings.cs
- DataGridViewToolTip.cs
- DecimalConverter.cs
- SqlCacheDependencyDatabaseCollection.cs
- RenamedEventArgs.cs
- HyperLinkField.cs
- MemoryStream.cs
- EventPrivateKey.cs
- RectValueSerializer.cs
- ExponentialEase.cs
- TypeConverterHelper.cs
- StandardBindingElementCollection.cs
- SystemWebCachingSectionGroup.cs
- SecurityChannelFaultConverter.cs
- UnsafeNativeMethods.cs
- OptimizerPatterns.cs
- SystemDiagnosticsSection.cs
- QueryCacheKey.cs
- OperationCanceledException.cs
- RectangleGeometry.cs
- ProviderBase.cs
- Crc32.cs
- Trace.cs
- Int32RectConverter.cs
- Column.cs
- AspNetCompatibilityRequirementsAttribute.cs
- SqlColumnizer.cs
- DependencyObject.cs
- PropertyConverter.cs
- SourceFilter.cs
- KeyInstance.cs
- StateMachineAction.cs
- DecimalConverter.cs
- ThreadInterruptedException.cs
- BindableTemplateBuilder.cs
- FileInfo.cs
- CommandValueSerializer.cs
- GlyphRunDrawing.cs
- UmAlQuraCalendar.cs
- TextTreeTextElementNode.cs
- WpfPayload.cs
- SelectedGridItemChangedEvent.cs
- RowToParametersTransformer.cs
- GACMembershipCondition.cs
- CapabilitiesPattern.cs
- MessagePropertyFilter.cs
- EventLogEntryCollection.cs
- SynchronizedDispatch.cs