using System;
class MyNullReferenceException: NullReferenceException
{
public override
string Message
{
get{return
"Ciao!";}
}
}
class Foo
{
static void
Main()
{
try
{
throw null
as
MyNullReferenceException;
}
catch(MyNullReferenceException
e)
{
Console.WriteLine(e.Message);
}
catch(NullReferenceException
e)
{
Console.WriteLine(e.Message);
}
}
}
Cosa viene visualizzato a console e perché?
- A. Object reference not set to an instance of an object.
- B. Ciao!
- C. non compila
- D. errore a run-time