| ||||||||||||||||||||||||||||||||||||
ObjectDisposedException ClassThe exception that is thrown when an operation is performed on a disposed object.
|
||||||||||||||||||||||||||||||||||||
| Visibility | Name | Value Type | Accessibility |
|---|---|---|---|
| public | Message | String | [ Get ] |
| public | ObjectName | String | [ Get ] |
| Visibility | Name | Parameters | Return Type |
|---|---|---|---|
| public | GetObjectData | ( SerializationInfo info , StreamingContext context ) | Void |
[ Visual Basic, C# ] The following example demonstrates an error that causes the ObjectDisposedException exception to be thrown.
[ VB ] Imports System Imports System.IO Public Class ObjectDisposedExceptionTest Public Shared Sub Main ( ) Dim ms As New MemoryStream ( 16 ) ms.Close ( ) Try ms.ReadByte ( ) Catch e As ObjectDisposedException Response.WriteLine ( "Caught: {0}", e.Message ) End Try End Sub 'Main End Class 'ObjectDisposedExceptionTest [ C# ] using System; using System.IO; public class ObjectDisposedExceptionTest { public static void Main ( ) { MemoryStream ms = new MemoryStream ( 16 ); ms.Close ( ); try { ms.ReadByte ( ); } catch ( ObjectDisposedException e ) { Response.WriteLine ( "Caught: {0}", e.Message ); } } }
[ Visual Basic, C# ] This code produces the following output:
[ Visual Basic, C# ] Caught:
Cannot access a closed Stream.
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme