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
- CodeObject.cs
- DataTableExtensions.cs
- EditorBrowsableAttribute.cs
- FilteredXmlReader.cs
- XamlFilter.cs
- COM2PictureConverter.cs
- RepeaterItemEventArgs.cs
- DataServiceHostFactory.cs
- ItemChangedEventArgs.cs
- _BufferOffsetSize.cs
- DataRelationPropertyDescriptor.cs
- AnnotationAuthorChangedEventArgs.cs
- DbConnectionPoolOptions.cs
- TableChangeProcessor.cs
- EmptyReadOnlyDictionaryInternal.cs
- NamedPipeHostedTransportConfiguration.cs
- ListBindableAttribute.cs
- DesignerCatalogPartChrome.cs
- SafeArrayTypeMismatchException.cs
- NonBatchDirectoryCompiler.cs
- InternalConfigHost.cs
- DoubleUtil.cs
- SetterBaseCollection.cs
- Base64Stream.cs
- ExpressionBuilder.cs
- MediaPlayerState.cs
- OleDbDataReader.cs
- PoisonMessageException.cs
- TypedDatasetGenerator.cs
- ProgramPublisher.cs
- SafeRegistryHandle.cs
- VectorAnimation.cs
- WebPartConnectionsEventArgs.cs
- RouteItem.cs
- SplitterEvent.cs
- AttachedPropertyInfo.cs
- SiteMapSection.cs
- ForeignKeyFactory.cs
- XmlNodeComparer.cs
- PageCatalogPartDesigner.cs
- BrowserCapabilitiesFactory.cs
- EntityDataSourceDesigner.cs
- PeerEndPoint.cs
- EventProviderBase.cs
- MenuCommand.cs
- CleanUpVirtualizedItemEventArgs.cs
- GestureRecognizer.cs
- ToolStripContainer.cs
- DataFormats.cs
- TraceHwndHost.cs
- SqlDataSourceCache.cs
- TraceSwitch.cs
- SaveFileDialog.cs
- Rotation3DAnimationBase.cs
- GridViewColumnHeaderAutomationPeer.cs
- SqlIdentifier.cs
- ExpandoObject.cs
- DefaultHttpHandler.cs
- PropertyGridCommands.cs
- RecipientIdentity.cs
- WindowsIdentity.cs
- SettingsPropertyValueCollection.cs
- XmlNamespaceManager.cs
- GridViewHeaderRowPresenter.cs
- WasAdminWrapper.cs
- MimeFormImporter.cs
- InkCanvas.cs
- FileUpload.cs
- Parameter.cs
- XmlSchemaAttribute.cs
- ImpersonationContext.cs
- FixedDocument.cs
- PermissionSetTriple.cs
- SqlConnectionManager.cs
- Ipv6Element.cs
- _HeaderInfoTable.cs
- TabControlCancelEvent.cs
- ExpressionHelper.cs
- SQlBooleanStorage.cs
- FontNamesConverter.cs
- TypeSemantics.cs
- FormatVersion.cs
- NativeWindow.cs
- WaitForChangedResult.cs
- WorkflowDebuggerSteppingAttribute.cs
- CorrelationService.cs
- _ListenerRequestStream.cs
- ResourcePermissionBase.cs
- Point3DAnimation.cs
- CustomErrorsSection.cs
- OleDbReferenceCollection.cs
- DataSysAttribute.cs
- DragStartedEventArgs.cs
- GlyphRunDrawing.cs
- ContentElement.cs
- DynamicDocumentPaginator.cs
- ProcessThread.cs
- SQLMembershipProvider.cs
- MessageFilterException.cs
- DataViewManager.cs