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
- AuthenticationServiceManager.cs
- WizardForm.cs
- TextBoxRenderer.cs
- x509utils.cs
- Header.cs
- ListParagraph.cs
- TypeElement.cs
- LinkedList.cs
- OrderedDictionaryStateHelper.cs
- Debug.cs
- SqlDataSourceStatusEventArgs.cs
- DataTablePropertyDescriptor.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- FontWeights.cs
- WebPartConnectionsCloseVerb.cs
- TextEvent.cs
- HwndTarget.cs
- EntityModelSchemaGenerator.cs
- TextElement.cs
- WsatServiceAddress.cs
- Vector3DCollection.cs
- SqlBooleanizer.cs
- ExportOptions.cs
- HttpCapabilitiesBase.cs
- EventsTab.cs
- FileSystemWatcher.cs
- MsmqIntegrationBindingCollectionElement.cs
- BaseParaClient.cs
- XmlAttributeOverrides.cs
- InternalPermissions.cs
- IdlingCommunicationPool.cs
- CachingHintValidation.cs
- EpmTargetPathSegment.cs
- UIElementPropertyUndoUnit.cs
- CodeTryCatchFinallyStatement.cs
- DetailsViewDeleteEventArgs.cs
- DependencyProperty.cs
- SafeRegistryKey.cs
- WebFaultClientMessageInspector.cs
- ValueTypePropertyReference.cs
- DataGridViewCellStyle.cs
- PolyLineSegment.cs
- CatchDesigner.xaml.cs
- AnimationTimeline.cs
- Marshal.cs
- CommonDialog.cs
- ErrorRuntimeConfig.cs
- OleStrCAMarshaler.cs
- WebPartTransformerCollection.cs
- SuppressMergeCheckAttribute.cs
- ObjectFullSpanRewriter.cs
- HtmlInputHidden.cs
- LocalIdCollection.cs
- CompensationDesigner.cs
- BlobPersonalizationState.cs
- PropertySegmentSerializationProvider.cs
- KeyManager.cs
- ReferenceSchema.cs
- EnumerableValidator.cs
- EventPropertyMap.cs
- ISFTagAndGuidCache.cs
- FormView.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- EnumBuilder.cs
- ResourceAttributes.cs
- FontUnit.cs
- TextServicesHost.cs
- SemanticValue.cs
- XmlCharCheckingWriter.cs
- OpCodes.cs
- ProfilePropertySettings.cs
- FileDialogPermission.cs
- RuntimeConfigurationRecord.cs
- HTTPRemotingHandler.cs
- ListSourceHelper.cs
- Claim.cs
- CodeMethodReturnStatement.cs
- DiffuseMaterial.cs
- BridgeDataReader.cs
- StringExpressionSet.cs
- XmlElementAttributes.cs
- SelectionGlyph.cs
- FieldDescriptor.cs
- CompensatableTransactionScopeActivityDesigner.cs
- DropSource.cs
- MetadataLocation.cs
- Block.cs
- ActivationArguments.cs
- XmlWriter.cs
- RotateTransform.cs
- SelectionChangedEventArgs.cs
- SelectionChangedEventArgs.cs
- OdbcEnvironment.cs
- XmlReflectionImporter.cs
- TextBox.cs
- NeutralResourcesLanguageAttribute.cs
- ThrowHelper.cs
- Span.cs
- SQLInt64.cs
- ObjectDataSourceStatusEventArgs.cs