© { JSL }
62
as
·
the
as
operator is similar
w
performs the conversion if the type is supported
w
returns
null
if its not
static void
GreyHole(
object
o)
{
IPluckable ip = o
as
IPluckable;
if
(ip !=
null
)
{
ip.Pluck();
...
}
}
static void
Main()
{
GreyHole(
new
Violin());
GreyHole(42);
}
check once