Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- HostingEnvironmentException.cs
- ObjectItemConventionAssemblyLoader.cs
- HtmlInputText.cs
- WindowsListViewItemCheckBox.cs
- PipelineModuleStepContainer.cs
- GroupByExpressionRewriter.cs
- CompilerWrapper.cs
- ZipFileInfo.cs
- NotificationContext.cs
- DetailsViewDeletedEventArgs.cs
- WebServiceHandler.cs
- SmiMetaData.cs
- ObjectTag.cs
- Quaternion.cs
- SoapFormatterSinks.cs
- UnsafeCollabNativeMethods.cs
- BuilderInfo.cs
- SmtpTransport.cs
- ImageAutomationPeer.cs
- HttpDebugHandler.cs
- DispatchWrapper.cs
- CompoundFileStreamReference.cs
- AssemblyBuilder.cs
- StoryFragments.cs
- IisTraceListener.cs
- RuleSetReference.cs
- WebUtil.cs
- PerfCounters.cs
- OledbConnectionStringbuilder.cs
- Transform.cs
- MouseBinding.cs
- Grant.cs
- StringBuilder.cs
- ApplicationException.cs
- OpCodes.cs
- RootProjectionNode.cs
- SemanticTag.cs
- StringComparer.cs
- BooleanKeyFrameCollection.cs
- DiagnosticTraceSource.cs
- ClientProxyGenerator.cs
- SqlNotificationEventArgs.cs
- UpdateCommandGenerator.cs
- Transform.cs
- DocumentPageHost.cs
- StrongName.cs
- BlobPersonalizationState.cs
- JsonReader.cs
- FormViewCommandEventArgs.cs
- MailMessageEventArgs.cs
- BamlVersionHeader.cs
- HandledMouseEvent.cs
- NameValuePermission.cs
- TypeDelegator.cs
- ZipIOFileItemStream.cs
- CompressStream.cs
- PathSegment.cs
- GPStream.cs
- ValidatedControlConverter.cs
- ExternalException.cs
- CatalogZone.cs
- XmlIncludeAttribute.cs
- ConfigurationManager.cs
- WebResourceUtil.cs
- ParsedAttributeCollection.cs
- DataTable.cs
- SimpleWorkerRequest.cs
- IRCollection.cs
- XmlChildEnumerator.cs
- ExpressionEditorSheet.cs
- OptimizedTemplateContentHelper.cs
- SemanticBasicElement.cs
- RIPEMD160.cs
- HttpCachePolicy.cs
- ApplicationManager.cs
- XmlWrappingWriter.cs
- SecurityHelper.cs
- ForwardPositionQuery.cs
- SdlChannelSink.cs
- SerTrace.cs
- HitTestWithGeometryDrawingContextWalker.cs
- BaseDataListComponentEditor.cs
- ScaleTransform.cs
- StringArrayConverter.cs
- AssociatedControlConverter.cs
- WaitingCursor.cs
- HuffCodec.cs
- HashFinalRequest.cs
- SecurityPolicySection.cs
- ColorEditor.cs
- KeyboardNavigation.cs
- WindowsEditBox.cs
- ZipIORawDataFileBlock.cs
- ByteConverter.cs
- DataGridViewColumnCollection.cs
- Graphics.cs
- ThemeableAttribute.cs
- ReferenceList.cs
- XPathCompileException.cs
- TextStore.cs