statement throw digunakan untuk membangkitkan exceptionI dalam program.
Contoh
using System;
class ContohThrow
{
public static void Main2()
{
try
{
Console.Write(“Ketik nama Anda: “);
string nama = Console.ReadLine();
if (nama!=”risman”)
throw new System.ApplicationException(“Nama tidak dikenal”);
Console.Write(“Selamat, Anda termasuk orang terkenal “);
}
catch(ApplicationException ae)
{
Console.WriteLine (“Exception: ” + ae.Message);
}
Console.ReadLine();
}
}