Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- OutOfMemoryException.cs
- LinearQuaternionKeyFrame.cs
- ObjectStateManagerMetadata.cs
- FontStyleConverter.cs
- OneOf.cs
- XmlAttributes.cs
- XmlNodeChangedEventArgs.cs
- ToolBarOverflowPanel.cs
- SqlDataReader.cs
- StateManagedCollection.cs
- ProviderSettings.cs
- TextEditorTyping.cs
- HttpListenerResponse.cs
- HtmlLiteralTextAdapter.cs
- WindowsMenu.cs
- XmlDataSourceNodeDescriptor.cs
- ShaderRenderModeValidation.cs
- SqlDataReader.cs
- PolicyLevel.cs
- ShortcutKeysEditor.cs
- EntityCollectionChangedParams.cs
- Hash.cs
- EventListenerClientSide.cs
- RefreshPropertiesAttribute.cs
- TextServicesCompartmentEventSink.cs
- DataGridViewMethods.cs
- ToolboxComponentsCreatingEventArgs.cs
- UIElement3D.cs
- X509Certificate2Collection.cs
- Misc.cs
- ExceptionRoutedEventArgs.cs
- BitmapEffectInput.cs
- Int32RectConverter.cs
- WizardSideBarListControlItemEventArgs.cs
- OleDbStruct.cs
- PersonalizationState.cs
- BamlRecordHelper.cs
- BulletChrome.cs
- SearchForVirtualItemEventArgs.cs
- ColumnResizeUndoUnit.cs
- ValueProviderWrapper.cs
- AttachmentCollection.cs
- DetailsViewDeletedEventArgs.cs
- AssemblySettingAttributes.cs
- RegexWorker.cs
- UpdateCommand.cs
- Dynamic.cs
- DesignerSerializerAttribute.cs
- PageStatePersister.cs
- ProjectionPathBuilder.cs
- HostedElements.cs
- Sequence.cs
- MultipartIdentifier.cs
- SocketException.cs
- KnownBoxes.cs
- XPathQilFactory.cs
- FixedPageStructure.cs
- Crc32.cs
- VideoDrawing.cs
- AbstractDataSvcMapFileLoader.cs
- CharacterHit.cs
- ResourceProviderFactory.cs
- XmlWriterTraceListener.cs
- HybridDictionary.cs
- EventDescriptorCollection.cs
- HScrollBar.cs
- Collection.cs
- SimpleBitVector32.cs
- StandardBindingElementCollection.cs
- DesignerForm.cs
- TextServicesCompartment.cs
- CustomLineCap.cs
- InputBindingCollection.cs
- WeakReferenceKey.cs
- SmiGettersStream.cs
- IisTraceListener.cs
- ReachUIElementCollectionSerializerAsync.cs
- ExpressionPrefixAttribute.cs
- PkcsUtils.cs
- InvocationExpression.cs
- XmlILTrace.cs
- ISAPIApplicationHost.cs
- ExecutedRoutedEventArgs.cs
- DesignTimeTemplateParser.cs
- ViewGenResults.cs
- EventArgs.cs
- EntityDataSourceDataSelection.cs
- GridViewSelectEventArgs.cs
- SmtpNtlmAuthenticationModule.cs
- DecimalConverter.cs
- PageParser.cs
- Switch.cs
- QueryExpr.cs
- RuntimeConfig.cs
- CommunicationObjectManager.cs
- CachingHintValidation.cs
- ToolboxItemImageConverter.cs
- KnownTypes.cs
- GeneralTransform2DTo3DTo2D.cs
- GiveFeedbackEventArgs.cs