In this lecture, the as keyword is used to attempt to cast the currently set runtime animator controller to an animator override controller. I found that as of C# 7, you can use pattern matching with the is keyword to simplify the code a bit. Included below with a link for more information.
if (weaponOverride != null)
{
animator.runtimeAnimatorController = weaponOverride;
}
else if (animator.runtimeAnimatorController is AnimatorOverrideController overrideController)
{
animator.runtimeAnimatorController = overrideController.runtimeAnimatorController;
}
More information: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/is