Take this example:
if (this.Url.IsLocalUrl(returnUrl))
{
return this.Redirect(returnUrl);
}
else
{
return this.RedirectToAction("Index");
}
It is rewritten as:
return this.Url.IsLocalUrl(returnUrl) ? this.Redirect(returnUrl) : this.RedirectToAction("Index");
However, the return types are not the same and the compiler should assume that the expression has the value of the return type, but it doesn't.
return this.Url.IsLocalUrl(returnUrl)
? (ActionResult)this.Redirect(returnUrl)
: this.RedirectToAction("Index");
Take this example:
It is rewritten as:
However, the return types are not the same and the compiler should assume that the expression has the value of the return type, but it doesn't.