as和强转之间的区别:
as转换类型失败时不会抛出异常;
强转类型失败时会抛出异常
引入is先对变量进行检验:
if (foo is int)
{
i = (int)foo;
}
logger log = null;
if (foo is logger)
{
log = foo as logger;
}