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
- LayoutTable.cs
- Point3D.cs
- DataKey.cs
- IssuanceTokenProviderBase.cs
- HitTestDrawingContextWalker.cs
- LambdaCompiler.Logical.cs
- SchemaImporterExtensionsSection.cs
- InitializerFacet.cs
- Range.cs
- COAUTHINFO.cs
- Hyperlink.cs
- XPathDocumentNavigator.cs
- TypeConverterHelper.cs
- PagerSettings.cs
- Thread.cs
- AutoResizedEvent.cs
- StylusPointPropertyId.cs
- AttributeData.cs
- SqlFileStream.cs
- BitSet.cs
- IntranetCredentialPolicy.cs
- DataGridCell.cs
- AuthorizationRuleCollection.cs
- WebUtil.cs
- BindStream.cs
- DelayedRegex.cs
- WindowsStartMenu.cs
- CopyNamespacesAction.cs
- Tuple.cs
- RolePrincipal.cs
- GenerateTemporaryTargetAssembly.cs
- UpDownBase.cs
- SystemIPGlobalProperties.cs
- StaticFileHandler.cs
- CodeActivityContext.cs
- SubclassTypeValidator.cs
- DeclarativeCatalogPart.cs
- SoapTypeAttribute.cs
- ProxyWebPartManager.cs
- Sql8ConformanceChecker.cs
- Assembly.cs
- MemberHolder.cs
- UpdateCompiler.cs
- UInt16Storage.cs
- Sentence.cs
- DirectoryInfo.cs
- ConnectorDragDropGlyph.cs
- StickyNote.cs
- ImageFormatConverter.cs
- SoapInteropTypes.cs
- SoundPlayer.cs
- OleDbConnection.cs
- UrlPropertyAttribute.cs
- CodeAttributeArgument.cs
- SoapUnknownHeader.cs
- AppDomainResourcePerfCounters.cs
- DynamicEndpointElement.cs
- OleDbTransaction.cs
- BitArray.cs
- GiveFeedbackEvent.cs
- CollectionsUtil.cs
- EdgeModeValidation.cs
- CalloutQueueItem.cs
- ComNativeDescriptor.cs
- TypeInfo.cs
- TypeBuilderInstantiation.cs
- RadioButtonFlatAdapter.cs
- WindowsRichEditRange.cs
- RewritingPass.cs
- MembershipPasswordException.cs
- FormsAuthenticationCredentials.cs
- EditorResources.cs
- DispatchWrapper.cs
- RoleService.cs
- MasterPageCodeDomTreeGenerator.cs
- HttpClientCertificate.cs
- WSFederationHttpSecurity.cs
- FormatterServices.cs
- InputProcessorProfilesLoader.cs
- UserPreferenceChangedEventArgs.cs
- BaseResourcesBuildProvider.cs
- WpfXamlLoader.cs
- DurableInstanceManager.cs
- SmiTypedGetterSetter.cs
- ElementHostAutomationPeer.cs
- DuplicateWaitObjectException.cs
- URLAttribute.cs
- CodeSnippetTypeMember.cs
- ImageFormat.cs
- coordinatorscratchpad.cs
- FixedPageAutomationPeer.cs
- TemplatedWizardStep.cs
- Timeline.cs
- TextServicesCompartment.cs
- CodeAccessSecurityEngine.cs
- FixedSOMTableCell.cs
- XmlObjectSerializerReadContext.cs
- DataGridViewEditingControlShowingEventArgs.cs
- HandlerWithFactory.cs
- MethodRental.cs