Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Runtime / Remoting / ObjectHandle.cs / 2 / ObjectHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: ObjectHandle ** ** ** ObjectHandle wraps object references. A Handle allows a ** marshal by value object to be returned through an ** indirection allowing the caller to control when the ** object is loaded into their domain. ** ** ===========================================================*/ namespace System.Runtime.Remoting{ using System; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Runtime.Remoting.Activation; using System.Runtime.Remoting.Lifetime; [ClassInterface(ClassInterfaceType.AutoDual)] [System.Runtime.InteropServices.ComVisible(true)] public class ObjectHandle: MarshalByRefObject, IObjectHandle { private Object WrappedObject; private ObjectHandle() { } public ObjectHandle(Object o) { WrappedObject = o; } public Object Unwrap() { return WrappedObject; } // ObjectHandle has a finite lifetime. For now the default // lifetime is being used, this can be changed in this method to // specify a custom lifetime. [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)] public override Object InitializeLifetimeService() { BCLDebug.Trace("REMOTE", "ObjectHandle.InitializeLifetimeService"); // // If the wrapped object has implemented InitializeLifetimeService to return null, // we don't want to go to the base class (which will result in a lease being // requested from the MarshalByRefObject, which starts up the LeaseManager, // which starts up the ThreadPool, adding three threads to the process. // We MarshalByRefObject mbr = WrappedObject as MarshalByRefObject; if (mbr != null) { Object o = mbr.InitializeLifetimeService(); if (o == null) return null; } ILease lease = (ILease)base.InitializeLifetimeService(); return lease; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DictionaryItemsCollection.cs
- TransformConverter.cs
- PageCodeDomTreeGenerator.cs
- LambdaCompiler.Expressions.cs
- Typeface.cs
- FontDialog.cs
- ReplyAdapterChannelListener.cs
- CroppedBitmap.cs
- RegexFCD.cs
- XmlStringTable.cs
- HttpWebRequestElement.cs
- SchemaMapping.cs
- HttpRequest.cs
- HatchBrush.cs
- FrameworkContentElementAutomationPeer.cs
- XPathParser.cs
- ArraySortHelper.cs
- DataGridComboBoxColumn.cs
- DropDownButton.cs
- IIS7WorkerRequest.cs
- CharEnumerator.cs
- BreakSafeBase.cs
- __ConsoleStream.cs
- TreeNodeBindingCollection.cs
- SynchronousChannel.cs
- SafeNativeMethods.cs
- ErrorTableItemStyle.cs
- SerializableAttribute.cs
- CapabilitiesRule.cs
- SystemException.cs
- ExtentCqlBlock.cs
- StringConcat.cs
- SystemException.cs
- Timeline.cs
- AppDomain.cs
- ListQueryResults.cs
- ExtensionWindow.cs
- ModuleElement.cs
- DefaultValidator.cs
- SettingsProviderCollection.cs
- LabelTarget.cs
- _BasicClient.cs
- DataGridSortCommandEventArgs.cs
- SQLDateTimeStorage.cs
- RectAnimationBase.cs
- HelpEvent.cs
- CacheAxisQuery.cs
- TextRunProperties.cs
- OleDbReferenceCollection.cs
- ContentTextAutomationPeer.cs
- CookieHandler.cs
- PathFigure.cs
- CodeDirectiveCollection.cs
- DetailsViewDeleteEventArgs.cs
- SchemaNotation.cs
- InvokeProviderWrapper.cs
- RuleInfoComparer.cs
- AppDomainProtocolHandler.cs
- ErrorFormatterPage.cs
- RuleSettings.cs
- XmlAttributeCollection.cs
- SimpleHandlerFactory.cs
- CommonDialog.cs
- ActionMessageFilterTable.cs
- Array.cs
- Guid.cs
- ConsumerConnectionPointCollection.cs
- SoapFormatExtensions.cs
- DependencyPropertyValueSerializer.cs
- LogRestartAreaEnumerator.cs
- ColorBlend.cs
- ToolStripContentPanelRenderEventArgs.cs
- PingOptions.cs
- InfoCardRequestException.cs
- Ref.cs
- CodeAssignStatement.cs
- ServiceDesigner.xaml.cs
- VideoDrawing.cs
- WebPartConnectionsConfigureVerb.cs
- NameValuePair.cs
- Page.cs
- UpdatePanelTrigger.cs
- ErrorRuntimeConfig.cs
- AddIn.cs
- ResourcePermissionBase.cs
- EnumValAlphaComparer.cs
- TemplateInstanceAttribute.cs
- TargetConverter.cs
- NumericUpDown.cs
- RectangleConverter.cs
- Dispatcher.cs
- DrawingContextDrawingContextWalker.cs
- DeferredElementTreeState.cs
- ImageField.cs
- WindowsTokenRoleProvider.cs
- ContainsRowNumberChecker.cs
- _AutoWebProxyScriptEngine.cs
- RemoteWebConfigurationHostServer.cs
- SoapFormatter.cs
- PerformanceCounterPermissionAttribute.cs