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
- ResourceDictionaryCollection.cs
- BindingObserver.cs
- JpegBitmapDecoder.cs
- TemplateField.cs
- SamlAudienceRestrictionCondition.cs
- MailMessage.cs
- ControllableStoryboardAction.cs
- SqlFlattener.cs
- AutomationFocusChangedEventArgs.cs
- CompositionAdorner.cs
- ActionFrame.cs
- VolatileEnlistmentMultiplexing.cs
- ActivityStatusChangeEventArgs.cs
- ping.cs
- WindowsSecurityToken.cs
- SafeHandles.cs
- EncodingDataItem.cs
- SqlRetyper.cs
- ParserContext.cs
- WindowsFormsLinkLabel.cs
- TableItemPatternIdentifiers.cs
- VScrollBar.cs
- SystemIPGlobalProperties.cs
- ExceptionValidationRule.cs
- ConditionalBranch.cs
- IconBitmapDecoder.cs
- TemplateAction.cs
- AutoResetEvent.cs
- HttpHandlersSection.cs
- SoapRpcMethodAttribute.cs
- Transform3DGroup.cs
- ProfileInfo.cs
- _WinHttpWebProxyDataBuilder.cs
- XmlSchemaImport.cs
- Sql8ExpressionRewriter.cs
- HealthMonitoringSectionHelper.cs
- CodeTypeMemberCollection.cs
- PropertyRef.cs
- CommunicationException.cs
- XmlDocumentType.cs
- SoapConverter.cs
- AdapterDictionary.cs
- TraceAsyncResult.cs
- TransformerInfoCollection.cs
- AttachedPropertyMethodSelector.cs
- AnnotationStore.cs
- InternalConfigEventArgs.cs
- TypeSemantics.cs
- SystemIcons.cs
- TextParagraphProperties.cs
- WinFormsComponentEditor.cs
- Membership.cs
- ImpersonationContext.cs
- WebPartVerb.cs
- TypeDelegator.cs
- SessionStateContainer.cs
- ReliabilityContractAttribute.cs
- ProfileEventArgs.cs
- WebPartTransformerCollection.cs
- BuildProvidersCompiler.cs
- Duration.cs
- DataFormats.cs
- ExceptionCollection.cs
- Set.cs
- AttributeUsageAttribute.cs
- CreateUserWizard.cs
- RpcResponse.cs
- xmlfixedPageInfo.cs
- UpDownBase.cs
- NamespaceDecl.cs
- ObjectStorage.cs
- KeySpline.cs
- TypeSystem.cs
- ChannelServices.cs
- WorkflowQueueInfo.cs
- XmlSchemaValidationException.cs
- ControlPager.cs
- ResourceContainer.cs
- DefaultTextStore.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- MaterializeFromAtom.cs
- recordstate.cs
- Span.cs
- TemplateContent.cs
- DataKeyCollection.cs
- CustomValidator.cs
- WebPartEventArgs.cs
- bidPrivateBase.cs
- PageContent.cs
- TransformGroup.cs
- DataExchangeServiceBinder.cs
- SqlClientWrapperSmiStream.cs
- Label.cs
- TextModifierScope.cs
- PropertyExpression.cs
- OleDbMetaDataFactory.cs
- BorderGapMaskConverter.cs
- Rijndael.cs
- Char.cs
- GlyphInfoList.cs