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
- WsatEtwTraceListener.cs
- DictionarySectionHandler.cs
- SamlAuthorityBinding.cs
- BitmapEffectInput.cs
- RegexParser.cs
- BufferModesCollection.cs
- TokenizerHelper.cs
- bidPrivateBase.cs
- util.cs
- EdmToObjectNamespaceMap.cs
- XmlElementAttribute.cs
- BufferedMessageWriter.cs
- ExpressionBuilderCollection.cs
- SimpleTableProvider.cs
- WebUtil.cs
- TextSearch.cs
- WebBrowser.cs
- SqlDeflator.cs
- AccessDataSourceView.cs
- safelinkcollection.cs
- AnalyzedTree.cs
- DetailsViewInsertEventArgs.cs
- Object.cs
- DependencyObject.cs
- DocumentXmlWriter.cs
- XmlBinaryReader.cs
- Compiler.cs
- TransactedBatchContext.cs
- KeyboardNavigation.cs
- XmlILTrace.cs
- SplineKeyFrames.cs
- XmlHierarchicalDataSourceView.cs
- XmlTextWriter.cs
- unitconverter.cs
- CellTreeNode.cs
- SecurityKeyType.cs
- HttpResponseInternalWrapper.cs
- TypeInitializationException.cs
- HTTPAPI_VERSION.cs
- WorkflowRequestContext.cs
- ActivationArguments.cs
- RemoveStoryboard.cs
- BamlLocalizer.cs
- StateBag.cs
- SimpleFileLog.cs
- SoapInteropTypes.cs
- ValidatorCompatibilityHelper.cs
- DataControlPagerLinkButton.cs
- DbConnectionOptions.cs
- CompilerError.cs
- StringToken.cs
- SafePipeHandle.cs
- ChildDocumentBlock.cs
- MetadataItem_Static.cs
- Speller.cs
- GreenMethods.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TimerElapsedEvenArgs.cs
- ObjectItemAttributeAssemblyLoader.cs
- Hyperlink.cs
- X509AsymmetricSecurityKey.cs
- GeneralTransformGroup.cs
- LoadRetryHandler.cs
- WrappedIUnknown.cs
- ControllableStoryboardAction.cs
- NullableIntMinMaxAggregationOperator.cs
- MetadataArtifactLoaderFile.cs
- WindowsSolidBrush.cs
- ObjectAssociationEndMapping.cs
- remotingproxy.cs
- X509CertificateEndpointIdentity.cs
- Tokenizer.cs
- BindingList.cs
- TextTrailingWordEllipsis.cs
- DataException.cs
- EvidenceBase.cs
- DataStorage.cs
- MarkupExtensionParser.cs
- ResourceContainer.cs
- HostedHttpContext.cs
- SHA512.cs
- WebConfigurationFileMap.cs
- TemplateControl.cs
- _ListenerRequestStream.cs
- FormatterConverter.cs
- ScalarRestriction.cs
- PageFunction.cs
- TextBox.cs
- _AutoWebProxyScriptWrapper.cs
- InheritablePropertyChangeInfo.cs
- XmlSchemaSequence.cs
- QueryPageSettingsEventArgs.cs
- DataGridViewDataConnection.cs
- ProviderConnectionPoint.cs
- FocusTracker.cs
- Send.cs
- HandlerBase.cs
- SQLInt32.cs
- PersistChildrenAttribute.cs
- DataControlFieldHeaderCell.cs