Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Log / System / IO / Log / SmuggledIUnknown.cs / 1305376 / SmuggledIUnknown.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Remoting.Services; internal sealed class SmuggledIUnknown : SafeHandle { internal SmuggledIUnknown() : base(IntPtr.Zero, true) { } internal SmuggledIUnknown(object unknown) : this() { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { base.handle = Marshal.GetIUnknownForObject(unknown); } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } public object Smuggle() { object comObject; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { comObject = EnterpriseServicesHelper.WrapIUnknownWithComObject(base.handle); GC.KeepAlive(this); } return comObject; } override protected bool ReleaseHandle() { if (base.handle != IntPtr.Zero) { Marshal.Release(base.handle); base.handle = IntPtr.Zero; } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Remoting.Services; internal sealed class SmuggledIUnknown : SafeHandle { internal SmuggledIUnknown() : base(IntPtr.Zero, true) { } internal SmuggledIUnknown(object unknown) : this() { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { base.handle = Marshal.GetIUnknownForObject(unknown); } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } public object Smuggle() { object comObject; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { comObject = EnterpriseServicesHelper.WrapIUnknownWithComObject(base.handle); GC.KeepAlive(this); } return comObject; } override protected bool ReleaseHandle() { if (base.handle != IntPtr.Zero) { Marshal.Release(base.handle); base.handle = IntPtr.Zero; } 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
- WebPartsPersonalizationAuthorization.cs
- DiscoveryReference.cs
- XmlFormatWriterGenerator.cs
- DataViewManager.cs
- UrlPropertyAttribute.cs
- X509CertificateValidator.cs
- Utils.cs
- StreamGeometryContext.cs
- _HTTPDateParse.cs
- LoginCancelEventArgs.cs
- CompletionCallbackWrapper.cs
- PlatformCulture.cs
- StoreItemCollection.Loader.cs
- TimestampInformation.cs
- LayoutDump.cs
- Graph.cs
- EventRouteFactory.cs
- InputScopeNameConverter.cs
- RequestTimeoutManager.cs
- Type.cs
- XmlLoader.cs
- RemotingSurrogateSelector.cs
- DataGridViewElement.cs
- RowBinding.cs
- TransformerTypeCollection.cs
- TextElementAutomationPeer.cs
- tooltip.cs
- SocketInformation.cs
- CannotUnloadAppDomainException.cs
- MappingSource.cs
- CompressedStack.cs
- StaticResourceExtension.cs
- RectangleHotSpot.cs
- ViewEventArgs.cs
- KnownTypesProvider.cs
- HorizontalAlignConverter.cs
- TextDocumentView.cs
- DataTable.cs
- VersionedStream.cs
- Clause.cs
- ClientData.cs
- KeyTime.cs
- WindowsPrincipal.cs
- SystemWebExtensionsSectionGroup.cs
- NavigationService.cs
- JulianCalendar.cs
- DefaultValueAttribute.cs
- DynamicResourceExtension.cs
- HtmlTableRow.cs
- BaseCollection.cs
- Clipboard.cs
- Util.cs
- MimeTypeAttribute.cs
- StructuredTypeEmitter.cs
- NavigationWindow.cs
- NamedElement.cs
- Stackframe.cs
- PartitionResolver.cs
- BaseTemplateParser.cs
- NumberSubstitution.cs
- TextElementEnumerator.cs
- WebBrowsableAttribute.cs
- AsnEncodedData.cs
- MaskedTextBox.cs
- WindowsButton.cs
- DiagnosticSection.cs
- TraceSource.cs
- InstanceHandleConflictException.cs
- TextElementCollection.cs
- RuleAction.cs
- WebResponse.cs
- SmiMetaData.cs
- UrlMappingCollection.cs
- DependencyPropertyKind.cs
- TextPointer.cs
- StartUpEventArgs.cs
- PermissionAttributes.cs
- StateDesigner.LayoutSelectionGlyph.cs
- InvariantComparer.cs
- XmlDocumentType.cs
- DataGridViewColumnHeaderCell.cs
- TypeDelegator.cs
- FilteredSchemaElementLookUpTable.cs
- AnonymousIdentificationSection.cs
- BinaryObjectReader.cs
- ToolboxItemFilterAttribute.cs
- TextEncodedRawTextWriter.cs
- FunctionImportElement.cs
- TypePropertyEditor.cs
- ResolveMatches11.cs
- SymLanguageVendor.cs
- QuinticEase.cs
- DPCustomTypeDescriptor.cs
- AlignmentXValidation.cs
- LambdaCompiler.cs
- PrtTicket_Base.cs
- ImageListUtils.cs
- Translator.cs
- DynamicResourceExtensionConverter.cs
- PtsCache.cs