646    {
  647        if (typeof(TOther) == typeof(byte))
  648        {
  649            return (
byte)(object)
value;
 
  650        }
  651        if (typeof(TOther) == typeof(char))
  652        {
  653            return (
char)(object)
value;
 
  654        }
  655        if (typeof(TOther) == typeof(decimal))
  656        {
  657            return (ushort)(decimal)(
object)
value;
 
  658        }
  659        if (typeof(TOther) == typeof(double))
  660        {
  661            return (ushort)(double)(
object)
value;
 
  662        }
  663        if (typeof(TOther) == typeof(short))
  664        {
  666        }
  667        if (typeof(TOther) == typeof(int))
  668        {
  669            return (ushort)(int)(
object)
value;
 
  670        }
  671        if (typeof(TOther) == typeof(long))
  672        {
  673            return (ushort)(long)(
object)
value;
 
  674        }
  675        if (typeof(TOther) == typeof(IntPtr))
  676        {
  677            return (ushort)(nint)(IntPtr)(object)
value;
 
  678        }
  679        if (typeof(TOther) == typeof(sbyte))
  680        {
  681            return (ushort)(sbyte)(
object)
value;
 
  682        }
  683        if (typeof(TOther) == typeof(float))
  684        {
  685            return (ushort)(float)(
object)
value;
 
  686        }
  687        if (typeof(TOther) == typeof(ushort))
  688        {
  689            return (ushort)(object)
value;
 
  690        }
  691        if (typeof(TOther) == typeof(uint))
  692        {
  693            return (ushort)(uint)(
object)
value;
 
  694        }
  695        if (typeof(TOther) == typeof(ulong))
  696        {
  697            return (ushort)(ulong)(
object)
value;
 
  698        }
  699        if (typeof(TOther) == typeof(UIntPtr))
  700        {
  701            return (ushort)(nuint)(UIntPtr)(object)
value;
 
  702        }
  703        ThrowHelper.ThrowNotSupportedException();
  704        return 0;
  705    }