| Visual Basic (Declaration) | |
|---|---|
<SerializableAttribute()> Public Class InterpreterException Inherits System.ApplicationException | |
| C# | |
|---|---|
[SerializableAttribute()] public class InterpreterException : System.ApplicationException | |
Library/Library.Test/TestCmdInterpreter.cs
| C# | Copy Code |
|---|---|
InterpreterException ex = null; try { throw new InterpreterException("TEST"); } catch (InterpreterException e) { ex = e; } Assert.IsNotNull(ex); BinaryFormatter bf = new BinaryFormatter(); using( MemoryStream ms = new MemoryStream() ) { bf.Serialize(ms, ex); ms.Position = 0; ex = (InterpreterException)bf.Deserialize(ms); Assert.AreEqual("TEST", ex.Message); } | |
| VB.NET | Copy Code |
|---|---|
Dim ex As InterpreterException = Nothing Try Throw New InterpreterException("TEST") Catch e As InterpreterException ex = e End Try Assert.IsNotNull(ex) Dim bf As New BinaryFormatter() Using ms As New MemoryStream() bf.Serialize(ms, ex) ms.Position = 0 ex = DirectCast(bf.Deserialize(ms), InterpreterException) Assert.AreEqual("TEST", ex.Message) End Using | |
System.Object
System.Exception
System.ApplicationException
CSharpTest.Net.Commands.InterpreterException
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7