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
- WinFormsUtils.cs
- InputMethod.cs
- Attributes.cs
- Buffer.cs
- AttributeUsageAttribute.cs
- DataRow.cs
- WithParamAction.cs
- DragEventArgs.cs
- UriParserTemplates.cs
- BCryptHashAlgorithm.cs
- EdmTypeAttribute.cs
- ColumnResult.cs
- LockCookie.cs
- SectionInformation.cs
- mda.cs
- InteropExecutor.cs
- AtlasWeb.Designer.cs
- ExpressionConverter.cs
- LocatorPart.cs
- FileDataSourceCache.cs
- DispatcherExceptionFilterEventArgs.cs
- RegistrationServices.cs
- ValidationErrorEventArgs.cs
- basevalidator.cs
- RuntimeArgumentHandle.cs
- VSWCFServiceContractGenerator.cs
- ping.cs
- configsystem.cs
- BindingExpressionBase.cs
- AppDomainUnloadedException.cs
- AsyncStreamReader.cs
- InternalPermissions.cs
- ServiceOperationParameter.cs
- XmlSchemaSimpleTypeRestriction.cs
- UnicodeEncoding.cs
- Identifier.cs
- CodeRemoveEventStatement.cs
- PropertyGeneratedEventArgs.cs
- IisTraceWebEventProvider.cs
- recordstatefactory.cs
- InteropBitmapSource.cs
- AttributeEmitter.cs
- _NTAuthentication.cs
- XmlNode.cs
- GenericIdentity.cs
- XmlAnyAttributeAttribute.cs
- CryptoProvider.cs
- OutputCacheSettings.cs
- TextProperties.cs
- WeakReference.cs
- PointConverter.cs
- AddingNewEventArgs.cs
- Track.cs
- DataGridItemEventArgs.cs
- IERequestCache.cs
- SwitchDesigner.xaml.cs
- SiteMapNodeItem.cs
- DocumentXPathNavigator.cs
- PreservationFileReader.cs
- KnownTypeDataContractResolver.cs
- HttpVersion.cs
- X509Certificate.cs
- ImportContext.cs
- ToolStripSeparator.cs
- GiveFeedbackEventArgs.cs
- NativeMethodsCLR.cs
- Validator.cs
- WindowShowOrOpenTracker.cs
- HostProtectionException.cs
- PlainXmlSerializer.cs
- TouchPoint.cs
- RegionInfo.cs
- ToolStripRenderer.cs
- CardSpaceException.cs
- GeometryCollection.cs
- CalendarSelectionChangedEventArgs.cs
- ElapsedEventArgs.cs
- BStrWrapper.cs
- Matrix.cs
- GroupLabel.cs
- CounterSample.cs
- DuplicateWaitObjectException.cs
- TransformedBitmap.cs
- SeparatorAutomationPeer.cs
- LogManagementAsyncResult.cs
- __Filters.cs
- DbParameterHelper.cs
- CalendarDateRange.cs
- MessageRpc.cs
- ToolStripRenderer.cs
- MatchingStyle.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- FocusChangedEventArgs.cs
- DesignBindingEditor.cs
- ServerValidateEventArgs.cs
- RegexGroup.cs
- FrameworkName.cs
- SortKey.cs
- TextHidden.cs
- AutomationPatternInfo.cs