Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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 || l
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FunctionDetailsReader.cs
- odbcmetadatacollectionnames.cs
- Canonicalizers.cs
- ChtmlImageAdapter.cs
- BoundsDrawingContextWalker.cs
- ManagedWndProcTracker.cs
- ListViewItem.cs
- ComboBoxRenderer.cs
- Currency.cs
- Rfc2898DeriveBytes.cs
- HttpException.cs
- NestPullup.cs
- TemplatePartAttribute.cs
- SQLString.cs
- Gdiplus.cs
- AuthenticationException.cs
- WebConvert.cs
- UInt16.cs
- CodeSnippetTypeMember.cs
- Setter.cs
- Stack.cs
- BamlCollectionHolder.cs
- DataSourceControlBuilder.cs
- ConstantSlot.cs
- MarkupExtensionParser.cs
- FunctionOverloadResolver.cs
- PassportIdentity.cs
- Material.cs
- FamilyTypefaceCollection.cs
- ValidatingCollection.cs
- ResourceDisplayNameAttribute.cs
- ColorContext.cs
- AutomationIdentifier.cs
- XmlDataSourceNodeDescriptor.cs
- PairComparer.cs
- TextDecorationLocationValidation.cs
- StylusPointDescription.cs
- NCryptNative.cs
- CharacterBufferReference.cs
- _TransmitFileOverlappedAsyncResult.cs
- StylusPointPropertyId.cs
- TypedTableHandler.cs
- SQLMembershipProvider.cs
- ClientOperation.cs
- FactoryMaker.cs
- EntitySet.cs
- Version.cs
- TextViewSelectionProcessor.cs
- Types.cs
- ConstructorExpr.cs
- DataSetFieldSchema.cs
- wgx_render.cs
- TimerEventSubscription.cs
- LinqDataSourceContextEventArgs.cs
- TableCell.cs
- Int64KeyFrameCollection.cs
- RegexEditorDialog.cs
- DescendentsWalker.cs
- HandlerWithFactory.cs
- FileIOPermission.cs
- EdmSchemaAttribute.cs
- ScrollProviderWrapper.cs
- XmlWrappingReader.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- HostingPreferredMapPath.cs
- ProfileEventArgs.cs
- SmtpClient.cs
- BatchParser.cs
- __Filters.cs
- RSAOAEPKeyExchangeFormatter.cs
- ComboBoxItem.cs
- StringSource.cs
- GeneratedView.cs
- XPathDocument.cs
- VariableModifiersHelper.cs
- ColorAnimationBase.cs
- Activity.cs
- COM2ExtendedTypeConverter.cs
- UrlPath.cs
- AuthenticationSection.cs
- LinqDataSourceEditData.cs
- XmlCustomFormatter.cs
- HttpCacheVary.cs
- WsatTransactionHeader.cs
- HtmlUtf8RawTextWriter.cs
- SecurityPermission.cs
- Point3D.cs
- RootDesignerSerializerAttribute.cs
- ComponentSerializationService.cs
- TextRunTypographyProperties.cs
- ControlDesignerState.cs
- CheckBoxRenderer.cs
- StylusDownEventArgs.cs
- NumberSubstitution.cs
- GroupByQueryOperator.cs
- PrintDocument.cs
- IndentedTextWriter.cs
- AssociationEndMember.cs
- RootProjectionNode.cs
- CalendarTable.cs