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
- CfgArc.cs
- HtmlWindowCollection.cs
- OdbcConnectionString.cs
- DataGridState.cs
- MatrixStack.cs
- DocumentAutomationPeer.cs
- ReachDocumentReferenceSerializerAsync.cs
- EpmSourceTree.cs
- AuthenticodeSignatureInformation.cs
- XamlTreeBuilderBamlRecordWriter.cs
- GenerateTemporaryAssemblyTask.cs
- WindowsImpersonationContext.cs
- OneToOneMappingSerializer.cs
- WebResourceAttribute.cs
- RangeValuePattern.cs
- ImmComposition.cs
- QilUnary.cs
- Tool.cs
- FixedDocument.cs
- Executor.cs
- WorkflowWebService.cs
- SchemaTableOptionalColumn.cs
- XmlEncoding.cs
- ResizeGrip.cs
- Filter.cs
- Int64.cs
- VerificationException.cs
- ServicePointManager.cs
- SQLBytesStorage.cs
- Events.cs
- ObjectToken.cs
- SqlTypeSystemProvider.cs
- DatatypeImplementation.cs
- BypassElementCollection.cs
- Quad.cs
- ScriptReferenceBase.cs
- XmlDataSource.cs
- Error.cs
- DbReferenceCollection.cs
- NotifyParentPropertyAttribute.cs
- KeyInterop.cs
- EntityContainer.cs
- GacUtil.cs
- SchemaImporter.cs
- ConditionValidator.cs
- MonitorWrapper.cs
- MimeBasePart.cs
- HttpConfigurationSystem.cs
- PrimaryKeyTypeConverter.cs
- DashStyles.cs
- SQLConvert.cs
- CodeIdentifiers.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- HttpApplication.cs
- ListBase.cs
- ContextMenuStrip.cs
- CodeDelegateInvokeExpression.cs
- WorkflowMarkupSerializer.cs
- PeerToPeerException.cs
- TableLayoutPanelCodeDomSerializer.cs
- OptimalBreakSession.cs
- AuthenticationService.cs
- MetabaseServerConfig.cs
- ObjectNotFoundException.cs
- PerspectiveCamera.cs
- SiteMembershipCondition.cs
- EndpointIdentityConverter.cs
- ExpressionCopier.cs
- EventWaitHandle.cs
- RangeContentEnumerator.cs
- XmlTextEncoder.cs
- StringToken.cs
- Translator.cs
- MergePropertyDescriptor.cs
- QilXmlWriter.cs
- SerialPinChanges.cs
- ControlPaint.cs
- State.cs
- PageThemeCodeDomTreeGenerator.cs
- EventBuilder.cs
- PermissionAttributes.cs
- DataViewListener.cs
- GridViewUpdateEventArgs.cs
- NameHandler.cs
- RowUpdatedEventArgs.cs
- SubpageParaClient.cs
- ToolTipAutomationPeer.cs
- ContentOperations.cs
- TemplateInstanceAttribute.cs
- UriWriter.cs
- BindingListCollectionView.cs
- HtmlValidationSummaryAdapter.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- DataTrigger.cs
- ActivationProxy.cs
- LambdaCompiler.Unary.cs
- Matrix3D.cs
- AssemblyCache.cs
- DataGridViewSelectedCellCollection.cs
- TraceContextRecord.cs