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
- DataGridComponentEditor.cs
- FlowLayoutPanelDesigner.cs
- Int16Converter.cs
- TreeNodeCollection.cs
- ContextInformation.cs
- FastEncoder.cs
- HttpCachePolicyWrapper.cs
- MailWebEventProvider.cs
- CTreeGenerator.cs
- xml.cs
- TreeNodeClickEventArgs.cs
- FamilyTypeface.cs
- WebPartZoneCollection.cs
- BitmapScalingModeValidation.cs
- SchemaEntity.cs
- Compilation.cs
- AnnouncementDispatcherAsyncResult.cs
- CultureInfo.cs
- MarkupCompiler.cs
- TextEditor.cs
- NativeMethods.cs
- LineServices.cs
- SystemWebSectionGroup.cs
- COM2ExtendedBrowsingHandler.cs
- SpecularMaterial.cs
- SoapCodeExporter.cs
- OdbcConnectionOpen.cs
- ServicePrincipalNameElement.cs
- XamlStream.cs
- SqlExpander.cs
- HashCoreRequest.cs
- Pts.cs
- ProcessThreadCollection.cs
- MatrixTransform.cs
- BinaryObjectInfo.cs
- ContextActivityUtils.cs
- FontWeight.cs
- TempFiles.cs
- HostedHttpContext.cs
- SqlConnectionStringBuilder.cs
- InfoCardXmlSerializer.cs
- ColumnClickEvent.cs
- DataGridComboBoxColumn.cs
- EncryptedData.cs
- EntityDataSourceValidationException.cs
- Control.cs
- IOException.cs
- TreeNode.cs
- CodeThrowExceptionStatement.cs
- AssemblyName.cs
- SwitchAttribute.cs
- ConstraintConverter.cs
- AssociativeAggregationOperator.cs
- FullTextBreakpoint.cs
- EntityStoreSchemaGenerator.cs
- ToolStripPanelRenderEventArgs.cs
- XmlName.cs
- QueryReaderSettings.cs
- SystemDiagnosticsSection.cs
- Int32RectValueSerializer.cs
- TypeInitializationException.cs
- PackageFilter.cs
- Internal.cs
- KnownTypeDataContractResolver.cs
- HtmlContainerControl.cs
- SafeCryptoHandles.cs
- Attributes.cs
- UIHelper.cs
- GotoExpression.cs
- ThreadExceptionDialog.cs
- StringValidatorAttribute.cs
- ExpressionEditorAttribute.cs
- DataGridViewLinkCell.cs
- RegexCapture.cs
- AnnotationHelper.cs
- PrintPreviewDialog.cs
- XsdBuilder.cs
- MarginCollapsingState.cs
- RangeValidator.cs
- ObjectPersistData.cs
- InputProviderSite.cs
- NetSectionGroup.cs
- ProfilePropertySettings.cs
- NodeFunctions.cs
- NameValuePermission.cs
- SequenceDesignerAccessibleObject.cs
- MethodCallConverter.cs
- FrugalList.cs
- PolyLineSegment.cs
- CqlErrorHelper.cs
- Decoder.cs
- webproxy.cs
- BrowserDefinitionCollection.cs
- CodeMemberProperty.cs
- SystemDropShadowChrome.cs
- Expressions.cs
- _LocalDataStore.cs
- ResXBuildProvider.cs
- HttpListenerRequestUriBuilder.cs
- Debug.cs