Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / ObjectDisposedException.cs / 1305376 / ObjectDisposedException.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
namespace System {
using System;
using System.Runtime.Serialization;
using System.Globalization;
using System.Security.Permissions;
///
/// The exception that is thrown when accessing an object that was
/// disposed.
///
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public class ObjectDisposedException : InvalidOperationException {
private String objectName;
// This constructor should only be called by the EE (COMPlusThrow)
private ObjectDisposedException() :
this(null ,Environment.GetResourceString("ObjectDisposed_Generic")) {
}
public ObjectDisposedException(String objectName) :
this(objectName, Environment.GetResourceString("ObjectDisposed_Generic")) {
}
public ObjectDisposedException(String objectName, String message) : base(message) {
SetErrorCode(__HResults.COR_E_OBJECTDISPOSED);
this.objectName = objectName;
}
public ObjectDisposedException(String message, Exception innerException)
: base(message, innerException) {
SetErrorCode(__HResults.COR_E_OBJECTDISPOSED);
}
///
/// Gets the text for the message for this exception.
///
public override String Message {
[System.Security.SecuritySafeCritical] // auto-generated
get {
String name = ObjectName;
if (name == null || name.Length == 0)
return base.Message;
String objectDisposed = Environment.GetResourceString("ObjectDisposed_ObjectName_Name", name);
return base.Message + Environment.NewLine + objectDisposed;
}
}
public String ObjectName {
get {
if (objectName == null)
return String.Empty;
return objectName;
}
}
[System.Security.SecuritySafeCritical] // auto-generated
protected ObjectDisposedException(SerializationInfo info, StreamingContext context) : base(info, context) {
objectName = info.GetString("ObjectName");
}
[System.Security.SecurityCritical] // auto-generated_required
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
info.AddValue("ObjectName",ObjectName,typeof(String));
}
}
}
// 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
- ClientConfigPaths.cs
- Ray3DHitTestResult.cs
- SecurityMessageProperty.cs
- CodeStatement.cs
- OletxTransactionManager.cs
- AuthenticateEventArgs.cs
- WorkflowViewManager.cs
- CharAnimationBase.cs
- Matrix.cs
- JournalEntry.cs
- Types.cs
- ChunkedMemoryStream.cs
- RegexGroup.cs
- EmptyImpersonationContext.cs
- UnaryNode.cs
- ConfigurationElement.cs
- Comparer.cs
- XmlSchemaComplexContent.cs
- CursorConverter.cs
- AutomationPeer.cs
- ServerIdentity.cs
- WebPartConnectionsCancelVerb.cs
- SoapUnknownHeader.cs
- TransformProviderWrapper.cs
- Visual3D.cs
- SwitchAttribute.cs
- MenuItemStyleCollection.cs
- Int32KeyFrameCollection.cs
- DynamicPropertyReader.cs
- DisplayInformation.cs
- TransactionManager.cs
- PropertyChangedEventManager.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- RangeValuePattern.cs
- RawTextInputReport.cs
- MSAANativeProvider.cs
- RtfFormatStack.cs
- TextBox.cs
- DataServiceEntityAttribute.cs
- DriveNotFoundException.cs
- ActivityUtilities.cs
- NoClickablePointException.cs
- Blend.cs
- WebPartsSection.cs
- SyndicationElementExtension.cs
- FormsAuthenticationCredentials.cs
- BackStopAuthenticationModule.cs
- ADConnectionHelper.cs
- TimelineGroup.cs
- SchemaLookupTable.cs
- MatcherBuilder.cs
- EmbeddedMailObject.cs
- SymbolType.cs
- SchemaObjectWriter.cs
- Border.cs
- TableItemPattern.cs
- CustomWebEventKey.cs
- TreeBuilder.cs
- AsymmetricAlgorithm.cs
- SessionStateContainer.cs
- BitmapEncoder.cs
- ValuePatternIdentifiers.cs
- StyleSheetComponentEditor.cs
- ServiceModelInstallComponent.cs
- RightsManagementPermission.cs
- ThumbAutomationPeer.cs
- SerializationInfo.cs
- XmlBaseReader.cs
- UICuesEvent.cs
- ClonableStack.cs
- APCustomTypeDescriptor.cs
- TcpConnectionPoolSettings.cs
- ZoneMembershipCondition.cs
- TextDecorationCollectionConverter.cs
- WebRequestModuleElementCollection.cs
- Suspend.cs
- BuildManagerHost.cs
- ReadContentAsBinaryHelper.cs
- NameScopePropertyAttribute.cs
- PropertyIdentifier.cs
- GCHandleCookieTable.cs
- ToolStripRendererSwitcher.cs
- BaseParser.cs
- BasicKeyConstraint.cs
- ServicePointManager.cs
- NameScope.cs
- SqlMetaData.cs
- CellConstant.cs
- NotifyInputEventArgs.cs
- BackStopAuthenticationModule.cs
- SafeHandle.cs
- _NetworkingPerfCounters.cs
- SchemaSetCompiler.cs
- PasswordRecoveryDesigner.cs
- ISAPIApplicationHost.cs
- PropertyChangedEventManager.cs
- MouseEventArgs.cs
- XPathScanner.cs
- DigitShape.cs
- SmiSettersStream.cs