public object Execute(object request) {
if (request is Request)
return service.Execute(request as Request);
else
throw new NotImplementedException();
}
Microsoft хочет, чтобы было так:
public object Execute(object request)
{
var r = request as Request;
if (r!=null)
return service.Execute(r);
else
throw new NotImplementedException();
}
потому что, как оказывается, "the "as" operator never throws an exception. Instead, if the indicated conversion is not possible, the resulting value is null."
No comments:
Post a Comment