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
- PrimitiveCodeDomSerializer.cs
- SoapEnumAttribute.cs
- TableLayoutColumnStyleCollection.cs
- SpecialNameAttribute.cs
- CheckBoxFlatAdapter.cs
- FlowPosition.cs
- WindowsFormsHelpers.cs
- BlurEffect.cs
- InteropTrackingRecord.cs
- FileIOPermission.cs
- SystemInfo.cs
- BaseTreeIterator.cs
- XmlIterators.cs
- BufferedWebEventProvider.cs
- KeyGestureValueSerializer.cs
- Context.cs
- ClonableStack.cs
- InternalSafeNativeMethods.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DbXmlEnabledProviderManifest.cs
- Logging.cs
- GridViewDeletedEventArgs.cs
- WebPartChrome.cs
- EdmProviderManifest.cs
- IisTraceListener.cs
- RtfToXamlReader.cs
- ProfileGroupSettingsCollection.cs
- GiveFeedbackEvent.cs
- IIS7UserPrincipal.cs
- AnnotationObservableCollection.cs
- CompositionTarget.cs
- TdsParserSafeHandles.cs
- DataFormats.cs
- Models.cs
- WindowProviderWrapper.cs
- WSFederationHttpSecurity.cs
- PeerNearMe.cs
- Compensate.cs
- ScalarConstant.cs
- ContainerControl.cs
- BitmapDownload.cs
- AttachedPropertyInfo.cs
- DataTransferEventArgs.cs
- UInt32Storage.cs
- PageParserFilter.cs
- SemanticAnalyzer.cs
- QueryInterceptorAttribute.cs
- ControlParameter.cs
- IIS7WorkerRequest.cs
- FilterElement.cs
- ApplicationActivator.cs
- VSDExceptions.cs
- WorkflowQueue.cs
- AncestorChangedEventArgs.cs
- Repeater.cs
- CodeDomSerializationProvider.cs
- Geometry.cs
- WpfWebRequestHelper.cs
- ForEachAction.cs
- TypedReference.cs
- MembershipUser.cs
- CodeNamespaceImport.cs
- HttpWriter.cs
- NextPreviousPagerField.cs
- ModelServiceImpl.cs
- ReferenceEqualityComparer.cs
- BooleanAnimationUsingKeyFrames.cs
- coordinator.cs
- ConfigurationSettings.cs
- ReachVisualSerializerAsync.cs
- SqlCharStream.cs
- ColorMatrix.cs
- SizeFConverter.cs
- SecondaryViewProvider.cs
- AsnEncodedData.cs
- XamlWriter.cs
- DefaultMergeHelper.cs
- LocationSectionRecord.cs
- CacheEntry.cs
- ErrorFormatter.cs
- ExpressionParser.cs
- AccessDataSource.cs
- XmlCDATASection.cs
- ValidationErrorInfo.cs
- NamespaceCollection.cs
- SiteMembershipCondition.cs
- TileBrush.cs
- AlphabeticalEnumConverter.cs
- SiteMapHierarchicalDataSourceView.cs
- ServiceDescriptionSerializer.cs
- BitStream.cs
- RayMeshGeometry3DHitTestResult.cs
- ObjectReferenceStack.cs
- StrongNameKeyPair.cs
- XmlSchemaParticle.cs
- ContractCodeDomInfo.cs
- LingerOption.cs
- WebBrowserUriTypeConverter.cs
- GroupItem.cs
- TextRangeSerialization.cs