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
- OdbcInfoMessageEvent.cs
- XslAst.cs
- UpdateExpressionVisitor.cs
- Pen.cs
- KernelTypeValidation.cs
- BasicBrowserDialog.cs
- ItemCheckedEvent.cs
- ExpandSegmentCollection.cs
- StoragePropertyMapping.cs
- SelectionWordBreaker.cs
- SerializeAbsoluteContext.cs
- XsltException.cs
- CodeDelegateInvokeExpression.cs
- XmlReaderSettings.cs
- ReflectionUtil.cs
- AxWrapperGen.cs
- ResourceContainer.cs
- MsmqIntegrationProcessProtocolHandler.cs
- CalendarDateRangeChangingEventArgs.cs
- SystemIcmpV4Statistics.cs
- mediaeventargs.cs
- TextTreeTextElementNode.cs
- WebConvert.cs
- IriParsingElement.cs
- ExtensionWindowResizeGrip.cs
- WindowsUpDown.cs
- LightweightCodeGenerator.cs
- Scalars.cs
- ClassDataContract.cs
- TextSelection.cs
- Span.cs
- Exceptions.cs
- PolicyStatement.cs
- ActivityDesignerAccessibleObject.cs
- WindowsToolbarAsMenu.cs
- WindowsHyperlink.cs
- ViewPort3D.cs
- ButtonStandardAdapter.cs
- DataGridViewCellStyleConverter.cs
- BamlResourceSerializer.cs
- XmlValueConverter.cs
- LocalizableResourceBuilder.cs
- DataGridViewHeaderCell.cs
- GroupBox.cs
- ContentWrapperAttribute.cs
- ProcessModuleCollection.cs
- ThreadTrace.cs
- SimpleHandlerBuildProvider.cs
- ScriptControl.cs
- AsyncOperationManager.cs
- _PooledStream.cs
- OperandQuery.cs
- References.cs
- ItemChangedEventArgs.cs
- DESCryptoServiceProvider.cs
- ConfigXmlComment.cs
- SortDescription.cs
- ResolveMatchesMessageCD1.cs
- _Events.cs
- ListBox.cs
- FileUtil.cs
- SecondaryIndexDefinition.cs
- EntityContainerAssociationSet.cs
- Win32SafeHandles.cs
- XmlSiteMapProvider.cs
- AddInStore.cs
- WindowsRegion.cs
- CachedCompositeFamily.cs
- GlyphingCache.cs
- WindowsGraphics.cs
- PTProvider.cs
- OrderedDictionary.cs
- FixedSOMPage.cs
- PageEventArgs.cs
- DataBindingValueUIHandler.cs
- Int32.cs
- dsa.cs
- HtmlImage.cs
- COAUTHINFO.cs
- Selector.cs
- DataGridViewCellStyle.cs
- StyleSheet.cs
- SaveFileDialog.cs
- SortQuery.cs
- CodeAttributeDeclarationCollection.cs
- FileLevelControlBuilderAttribute.cs
- IODescriptionAttribute.cs
- DataGridViewSortCompareEventArgs.cs
- BitSet.cs
- XPathCompileException.cs
- CanonicalFormWriter.cs
- WhiteSpaceTrimStringConverter.cs
- CompleteWizardStep.cs
- ServiceDurableInstance.cs
- SevenBitStream.cs
- HtmlElementCollection.cs
- EntityDataSourceWrapperCollection.cs
- AccessDataSource.cs
- HelpEvent.cs
- Connector.xaml.cs