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
- HtmlEmptyTagControlBuilder.cs
- XomlDesignerLoader.cs
- SyndicationSerializer.cs
- DataSysAttribute.cs
- XNodeValidator.cs
- PerformanceCounterCategory.cs
- CompilerInfo.cs
- HierarchicalDataBoundControl.cs
- PropertyFilterAttribute.cs
- CodeExporter.cs
- InlineCollection.cs
- DateTimeSerializationSection.cs
- IntAverageAggregationOperator.cs
- HostedNamedPipeTransportManager.cs
- RtfFormatStack.cs
- AnnotationComponentChooser.cs
- CheckedListBox.cs
- ClientSideQueueItem.cs
- BypassElement.cs
- VirtualDirectoryMappingCollection.cs
- UInt32.cs
- BaseCollection.cs
- ConstructorNeedsTagAttribute.cs
- InputBinding.cs
- LambdaCompiler.Binary.cs
- TextParagraph.cs
- SafeNativeMethods.cs
- HitTestParameters.cs
- SharedStatics.cs
- DocumentApplicationState.cs
- XmlNamespaceMappingCollection.cs
- ResourceExpressionEditor.cs
- SupportsEventValidationAttribute.cs
- InvalidFilterCriteriaException.cs
- TextBox.cs
- GenericWebPart.cs
- PauseStoryboard.cs
- ColorConverter.cs
- PropertyEmitter.cs
- ISAPIApplicationHost.cs
- StylusSystemGestureEventArgs.cs
- JsonWriter.cs
- AnimationClock.cs
- ColumnCollectionEditor.cs
- ButtonPopupAdapter.cs
- AllMembershipCondition.cs
- RepeatInfo.cs
- _NativeSSPI.cs
- ResourceManagerWrapper.cs
- HttpStreams.cs
- EventLogPermissionEntryCollection.cs
- TaskFileService.cs
- ParsedAttributeCollection.cs
- ListBox.cs
- TypeDependencyAttribute.cs
- CompareInfo.cs
- TabControl.cs
- UrlMappingsSection.cs
- SchemaType.cs
- EntityContainer.cs
- MediaElementAutomationPeer.cs
- WebPermission.cs
- FileNotFoundException.cs
- CheckPair.cs
- ConstantExpression.cs
- RoleService.cs
- DataViewSettingCollection.cs
- ObfuscateAssemblyAttribute.cs
- RuleEngine.cs
- ViewManager.cs
- PrimarySelectionGlyph.cs
- TickBar.cs
- ObjectDataSourceChooseMethodsPanel.cs
- CqlIdentifiers.cs
- Normalization.cs
- CollectionType.cs
- DiscoveryClientProtocol.cs
- SQLMoney.cs
- DropSource.cs
- Metadata.cs
- Window.cs
- AlternateViewCollection.cs
- CacheOutputQuery.cs
- MethodExpr.cs
- SwitchAttribute.cs
- FullTextState.cs
- InstanceHandle.cs
- UnhandledExceptionEventArgs.cs
- UrlMappingsModule.cs
- ToolboxDataAttribute.cs
- linebase.cs
- TypeSemantics.cs
- InternalBufferOverflowException.cs
- IFormattable.cs
- LinqDataSourceView.cs
- ParserContext.cs
- ToolStripGrip.cs
- RulePatternOps.cs
- WindowProviderWrapper.cs
- TableRow.cs