March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
using System.IO;
namespace Samples
{
public class NotSupprotedExceptionSample
{
public static void Main()
{
Byte[] bytes = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
MemoryStream ms = new MemoryStream(
bytes,0, bytes.Length,
false, false);
try
{
ms.WriteByte((Byte)0);
}
catch(NotSupportedException e)
{
Console.WriteLine("Exception: {0}", e);
}
finally
{
ms.Close();
}
}
}
}
Exception: System.NotSupportedException: Stream does not support writing. at System.IO.__Error.WriteNotSupported() at System.IO.MemoryStream.WriteByte(Byte value) at Samples.NotSupprotedExceptionSample.Main() in C:\Books\BCL\Samples\System\ NotSupportedException\NotSupportedException.cs:line 16
Read now
Unlock full access