Code:
/ FX-1434 / FX-1434 / 1.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
- URLIdentityPermission.cs
- MsmqInputMessage.cs
- UnmanagedMemoryStreamWrapper.cs
- TextParaClient.cs
- VisualTreeUtils.cs
- ReferentialConstraint.cs
- URLAttribute.cs
- RegexCapture.cs
- QilList.cs
- IntSecurity.cs
- ConfigWriter.cs
- WebPartChrome.cs
- ParenthesizePropertyNameAttribute.cs
- SHA256.cs
- FormViewPageEventArgs.cs
- CustomDictionarySources.cs
- Win32.cs
- SslStream.cs
- DateTimeHelper.cs
- SmtpFailedRecipientException.cs
- ClassicBorderDecorator.cs
- OleCmdHelper.cs
- SchemaConstraints.cs
- OleDbFactory.cs
- SessionParameter.cs
- IPeerNeighbor.cs
- DefaultHttpHandler.cs
- ListViewItemMouseHoverEvent.cs
- PassportAuthentication.cs
- ToolStripRendererSwitcher.cs
- CategoryList.cs
- ControlType.cs
- XLinq.cs
- Literal.cs
- TypeUnloadedException.cs
- XmlWriter.cs
- XmlSchemaElement.cs
- QueryCacheEntry.cs
- UpdateExpressionVisitor.cs
- StubHelpers.cs
- UserPreferenceChangingEventArgs.cs
- PerfCounterSection.cs
- HtmlInputButton.cs
- LinkLabelLinkClickedEvent.cs
- RichTextBox.cs
- TreeViewEvent.cs
- sqlnorm.cs
- PageRequestManager.cs
- BrowserDefinitionCollection.cs
- SiblingIterators.cs
- DataGridViewRowsAddedEventArgs.cs
- ISAPIWorkerRequest.cs
- XsltArgumentList.cs
- ConfigXmlElement.cs
- _UriTypeConverter.cs
- CryptoProvider.cs
- GlobalizationSection.cs
- SchemaImporter.cs
- PresentationTraceSources.cs
- StringUtil.cs
- Rule.cs
- SchemaImporter.cs
- ProcessHostServerConfig.cs
- RemoteCryptoRsaServiceProvider.cs
- DesignerResources.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- RuleInfoComparer.cs
- EmptyEnumerator.cs
- OSFeature.cs
- ByteKeyFrameCollection.cs
- GridItemPattern.cs
- HierarchicalDataBoundControlAdapter.cs
- AttributeCollection.cs
- TextRenderer.cs
- ScriptBehaviorDescriptor.cs
- AsnEncodedData.cs
- RequiredArgumentAttribute.cs
- BindingContext.cs
- SqlConnectionStringBuilder.cs
- GeneralTransform3D.cs
- Deflater.cs
- RadioButtonFlatAdapter.cs
- DataGridViewTopLeftHeaderCell.cs
- GlobalAllocSafeHandle.cs
- SubpageParaClient.cs
- TempFiles.cs
- RuntimeEnvironment.cs
- ManipulationInertiaStartingEventArgs.cs
- TextWriter.cs
- x509utils.cs
- SignedXml.cs
- DBSchemaRow.cs
- Source.cs
- DataBoundControlAdapter.cs
- WebPartManagerInternals.cs
- XmlArrayItemAttribute.cs
- IResourceProvider.cs
- TimeStampChecker.cs
- IntegerValidatorAttribute.cs
- ConstraintConverter.cs