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
- PeerDuplexChannel.cs
- StretchValidation.cs
- TypeConverterValueSerializer.cs
- ApplyHostConfigurationBehavior.cs
- LassoSelectionBehavior.cs
- FontUnitConverter.cs
- XPathScanner.cs
- AssemblyLoader.cs
- InvalidProgramException.cs
- LayoutInformation.cs
- FigureParaClient.cs
- TransformerInfoCollection.cs
- CurrentChangedEventManager.cs
- _SpnDictionary.cs
- ApplicationDirectoryMembershipCondition.cs
- WebException.cs
- ScriptComponentDescriptor.cs
- WebPartZoneCollection.cs
- SecurityDocument.cs
- AsyncResult.cs
- SelectedDatesCollection.cs
- TemplateAction.cs
- SecureStringHasher.cs
- MenuScrollingVisibilityConverter.cs
- TypeValidationEventArgs.cs
- ExtensionSimplifierMarkupObject.cs
- SystemWebExtensionsSectionGroup.cs
- WindowsHyperlink.cs
- EmissiveMaterial.cs
- TreeView.cs
- ArrayList.cs
- EventItfInfo.cs
- UrlMappingsModule.cs
- GiveFeedbackEvent.cs
- TextPattern.cs
- ConstructorBuilder.cs
- SchemaCollectionPreprocessor.cs
- mda.cs
- AssemblyBuilderData.cs
- WebPartEditorOkVerb.cs
- CharacterMetrics.cs
- XdrBuilder.cs
- DbDataSourceEnumerator.cs
- Material.cs
- SoapInteropTypes.cs
- sqlcontext.cs
- BitmapEffectGeneralTransform.cs
- WebPartRestoreVerb.cs
- Win32.cs
- ToolStripPanel.cs
- SqlUDTStorage.cs
- HttpRequestContext.cs
- PageEventArgs.cs
- RsaSecurityTokenAuthenticator.cs
- WebDescriptionAttribute.cs
- ApplicationDirectory.cs
- AddInContractAttribute.cs
- TerminatorSinks.cs
- PreservationFileWriter.cs
- FontSource.cs
- PeerCustomResolverBindingElement.cs
- FixedSOMTextRun.cs
- LinkButton.cs
- EventItfInfo.cs
- PrintDialog.cs
- XpsFilter.cs
- HttpApplication.cs
- TextTreeInsertUndoUnit.cs
- CancelRequestedRecord.cs
- AuthenticationConfig.cs
- ProviderException.cs
- ReliabilityContractAttribute.cs
- DataGridCellInfo.cs
- XPathItem.cs
- ConfigurationValues.cs
- ToolStripLocationCancelEventArgs.cs
- EventProvider.cs
- _IPv6Address.cs
- SqlProviderUtilities.cs
- XmlElementElement.cs
- MobileControlBuilder.cs
- XmlIlTypeHelper.cs
- OrderedParallelQuery.cs
- DataSourceSelectArguments.cs
- XmlAttributeHolder.cs
- PrintDialogException.cs
- ContentPosition.cs
- SqlParameterCollection.cs
- PropertyDescriptorGridEntry.cs
- Internal.cs
- Enum.cs
- Recipient.cs
- SoapIncludeAttribute.cs
- DesignObjectWrapper.cs
- BaseCodeDomTreeGenerator.cs
- XamlSerializerUtil.cs
- NTAccount.cs
- RegisteredDisposeScript.cs
- BaseResourcesBuildProvider.cs
- PathSegmentCollection.cs