Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / tx / System / Transactions / SafeIUnknown.cs / 1305376 / SafeIUnknown.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Transactions { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Security.Permissions; // Keep an interface pointer that will not be used in a SafeHandle derived so // that it will be properly released. internal sealed class SafeIUnknown : SafeHandle { // This constructor is called by ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SafeIUnknown() : base(IntPtr.Zero, true) { } // This constructor is called by ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SafeIUnknown(IntPtr unknown) : base(IntPtr.Zero, true) { RuntimeHelpers.PrepareConstrainedRegions(); try {} finally { base.handle = unknown; } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } override protected bool ReleaseHandle() { // NOTE: The SafeHandle class guarantees this will be called exactly once. IntPtr ptr = base.handle; base.handle = IntPtr.Zero; if (IntPtr.Zero != ptr) { Marshal.Release(ptr); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NativeWindow.cs
- DesignerAutoFormatStyle.cs
- MimeReflector.cs
- SplineQuaternionKeyFrame.cs
- SplitterDesigner.cs
- BamlResourceDeserializer.cs
- RichTextBoxAutomationPeer.cs
- SqlException.cs
- SqlDataAdapter.cs
- URLAttribute.cs
- InternalDuplexChannelFactory.cs
- HttpListenerException.cs
- TextDecorationCollection.cs
- XPathDocumentBuilder.cs
- PositiveTimeSpanValidatorAttribute.cs
- CodeConstructor.cs
- Pointer.cs
- HtmlInputText.cs
- HandleCollector.cs
- BitmapFrame.cs
- BoolLiteral.cs
- ImageInfo.cs
- ReadOnlyTernaryTree.cs
- StatusBarItem.cs
- filewebresponse.cs
- DefaultExpression.cs
- ItemsChangedEventArgs.cs
- MobileControlBuilder.cs
- ErrorFormatterPage.cs
- SequentialWorkflowHeaderFooter.cs
- ActivityMarkupSerializer.cs
- InkPresenter.cs
- Common.cs
- SpellerStatusTable.cs
- Types.cs
- Contracts.cs
- AssociationTypeEmitter.cs
- SchemeSettingElementCollection.cs
- ResXBuildProvider.cs
- ProfileServiceManager.cs
- Nullable.cs
- GlyphInfoList.cs
- GraphicsPathIterator.cs
- ParsedRoute.cs
- ZoneMembershipCondition.cs
- AnnotationResourceChangedEventArgs.cs
- StrongName.cs
- EntityKeyElement.cs
- regiisutil.cs
- StringStorage.cs
- ListBoxItemWrapperAutomationPeer.cs
- SignatureDescription.cs
- Int16KeyFrameCollection.cs
- InvokePatternIdentifiers.cs
- DataTableReaderListener.cs
- ObjectAnimationBase.cs
- FunctionDescription.cs
- EncoderFallback.cs
- Utils.cs
- XmlSignatureManifest.cs
- PassportAuthentication.cs
- SafeNativeMethodsOther.cs
- FlowchartDesignerCommands.cs
- ToolStripContentPanelRenderEventArgs.cs
- ContainerUtilities.cs
- PersonalizableTypeEntry.cs
- ListManagerBindingsCollection.cs
- _HeaderInfo.cs
- CounterSample.cs
- AspNetCacheProfileAttribute.cs
- ChtmlTextWriter.cs
- Panel.cs
- XmlSchemaIdentityConstraint.cs
- ObjectResult.cs
- RecordManager.cs
- ControllableStoryboardAction.cs
- DataGridViewTextBoxCell.cs
- DateTimePicker.cs
- XmlSchemaSet.cs
- TextEditorContextMenu.cs
- EdmComplexPropertyAttribute.cs
- ObjectListDesigner.cs
- AdornerDecorator.cs
- LoginUtil.cs
- AdPostCacheSubstitution.cs
- AutomationFocusChangedEventArgs.cs
- _OSSOCK.cs
- RoleGroup.cs
- MimeMultiPart.cs
- ConfigUtil.cs
- EditorBrowsableAttribute.cs
- PointAnimationUsingKeyFrames.cs
- Pair.cs
- SqlProcedureAttribute.cs
- InitializationEventAttribute.cs
- TemplateKeyConverter.cs
- TraceSource.cs
- ExtensionWindowHeader.cs
- HttpDictionary.cs
- TagPrefixAttribute.cs