Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / ObjectDisposedException.cs / 1 / 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 {
get {
String name = ObjectName;
if (name == null || name.Length == 0)
return base.Message;
return base.Message + Environment.NewLine + String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ObjectDisposed_ObjectName_Name"), name);
}
}
public String ObjectName {
get {
if (objectName == null)
return String.Empty;
return objectName;
}
}
protected ObjectDisposedException(SerializationInfo info, StreamingContext context) : base(info, context) {
objectName = info.GetString("ObjectName");
}
[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
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.
// ==++==
//
// 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 {
get {
String name = ObjectName;
if (name == null || name.Length == 0)
return base.Message;
return base.Message + Environment.NewLine + String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ObjectDisposed_ObjectName_Name"), name);
}
}
public String ObjectName {
get {
if (objectName == null)
return String.Empty;
return objectName;
}
}
protected ObjectDisposedException(SerializationInfo info, StreamingContext context) : base(info, context) {
objectName = info.GetString("ObjectName");
}
[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
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
- _SslStream.cs
- QualifiedCellIdBoolean.cs
- UserPreferenceChangedEventArgs.cs
- GridViewUpdatedEventArgs.cs
- ListenerSessionConnectionReader.cs
- ScaleTransform3D.cs
- CodeAttributeDeclaration.cs
- UnaryExpression.cs
- DataGridViewCellFormattingEventArgs.cs
- ErrorFormatter.cs
- SwitchElementsCollection.cs
- SingleAnimationBase.cs
- StatusStrip.cs
- ClientSettingsStore.cs
- AuthenticationModuleElementCollection.cs
- ProbeRequestResponseAsyncResult.cs
- ConfigXmlWhitespace.cs
- DeobfuscatingStream.cs
- MissingMemberException.cs
- WindowsTreeView.cs
- QuadraticBezierSegment.cs
- PixelFormatConverter.cs
- StrongTypingException.cs
- SchemaConstraints.cs
- DoubleLinkListEnumerator.cs
- FtpRequestCacheValidator.cs
- XmlSchemaDatatype.cs
- smtppermission.cs
- OdbcInfoMessageEvent.cs
- GridViewColumnCollection.cs
- DataGridViewCellLinkedList.cs
- ExportOptions.cs
- IODescriptionAttribute.cs
- Command.cs
- TraceHwndHost.cs
- _HeaderInfoTable.cs
- IndexerNameAttribute.cs
- StreamGeometryContext.cs
- LogSwitch.cs
- FlowDocumentReaderAutomationPeer.cs
- TextServicesHost.cs
- BinaryObjectReader.cs
- PropertyItemInternal.cs
- TypedTableBaseExtensions.cs
- MeasurementDCInfo.cs
- xmlfixedPageInfo.cs
- baseaxisquery.cs
- CodeConstructor.cs
- CapacityStreamGeometryContext.cs
- ExpressionBindings.cs
- BindToObject.cs
- DataGridHelper.cs
- WebPartHeaderCloseVerb.cs
- StatusBarPanelClickEvent.cs
- TimeoutHelper.cs
- ProfessionalColors.cs
- ActivityTrace.cs
- XmlResolver.cs
- MemberDescriptor.cs
- UrlMappingsSection.cs
- EqualityComparer.cs
- AdRotator.cs
- TransactionScope.cs
- LockedActivityGlyph.cs
- TcpTransportManager.cs
- XmlDataProvider.cs
- LoginNameDesigner.cs
- DefaultHttpHandler.cs
- MobileContainerDesigner.cs
- Fonts.cs
- EditCommandColumn.cs
- StrokeNodeOperations2.cs
- XMLDiffLoader.cs
- WorkflowDebuggerSteppingAttribute.cs
- ExtendedPropertyCollection.cs
- HelpEvent.cs
- _ListenerResponseStream.cs
- ComponentEditorPage.cs
- TextRenderingModeValidation.cs
- SmiGettersStream.cs
- SHA1.cs
- GetChildSubtree.cs
- RangeValidator.cs
- MouseDevice.cs
- SafeCryptoHandles.cs
- SmiXetterAccessMap.cs
- PrintDocument.cs
- Style.cs
- SequenceDesigner.cs
- Suspend.cs
- EntityDataSourceContextCreatedEventArgs.cs
- GridViewCancelEditEventArgs.cs
- CaseCqlBlock.cs
- UseLicense.cs
- CFGGrammar.cs
- _FixedSizeReader.cs
- SymbolTable.cs
- _UncName.cs
- GreenMethods.cs
- ElementProxy.cs