759 {
760 if (typeof(TOther) == typeof(byte))
761 {
762 result = (byte)(
object)
value;
763 return true;
764 }
765 if (typeof(TOther) == typeof(char))
766 {
767 char c = (char)(
object)
value;
768 if (c > 'ΓΏ')
769 {
770 result = 0;
771 return false;
772 }
773 result = (byte)c;
774 return true;
775 }
776 if (typeof(TOther) == typeof(decimal))
777 {
778 decimal num = (decimal)(
object)
value;
779 if (num < 0m || num > 255m)
780 {
781 result = 0;
782 return false;
783 }
784 result = (byte)num;
785 return true;
786 }
787 if (typeof(TOther) == typeof(double))
788 {
789 double num2 = (double)(
object)
value;
790 if (num2 < 0.0 || num2 > 255.0)
791 {
792 result = 0;
793 return false;
794 }
795 result = (byte)num2;
796 return true;
797 }
798 if (typeof(TOther) == typeof(short))
799 {
801 if (num3 < 0 || num3 > 255)
802 {
803 result = 0;
804 return false;
805 }
806 result = (byte)num3;
807 return true;
808 }
809 if (typeof(TOther) == typeof(int))
810 {
811 int num4 = (int)(
object)
value;
812 if (num4 < 0 || num4 > 255)
813 {
814 result = 0;
815 return false;
816 }
817 result = (byte)num4;
818 return true;
819 }
820 if (typeof(TOther) == typeof(long))
821 {
822 long num5 = (long)(
object)
value;
823 if (num5 < 0 || num5 > 255)
824 {
825 result = 0;
826 return false;
827 }
828 result = (byte)num5;
829 return true;
830 }
831 if (typeof(TOther) == typeof(IntPtr))
832 {
834 if ((nint)intPtr < 0 || (nint)intPtr > 255)
835 {
836 result = 0;
837 return false;
838 }
839 result = (byte)(nint)intPtr;
840 return true;
841 }
842 if (typeof(TOther) == typeof(sbyte))
843 {
844 sbyte b = (sbyte)(
object)
value;
845 if (b < 0)
846 {
847 result = 0;
848 return false;
849 }
850 result = (byte)b;
851 return true;
852 }
853 if (typeof(TOther) == typeof(float))
854 {
855 float num6 = (float)(
object)
value;
856 if (num6 < 0f || num6 > 255f)
857 {
858 result = 0;
859 return false;
860 }
861 result = (byte)num6;
862 return true;
863 }
864 if (typeof(TOther) == typeof(ushort))
865 {
866 ushort num7 = (ushort)(
object)
value;
867 if (num7 > 255)
868 {
869 result = 0;
870 return false;
871 }
872 result = (byte)num7;
873 return true;
874 }
875 if (typeof(TOther) == typeof(uint))
876 {
877 uint num8 = (uint)(
object)
value;
878 if (num8 > 255)
879 {
880 result = 0;
881 return false;
882 }
883 result = (byte)num8;
884 return true;
885 }
886 if (typeof(TOther) == typeof(ulong))
887 {
888 ulong num9 = (ulong)(
object)
value;
889 if (num9 > 255)
890 {
891 result = 0;
892 return false;
893 }
894 result = (byte)num9;
895 return true;
896 }
897 if (typeof(TOther) == typeof(UIntPtr))
898 {
900 if ((nuint)uIntPtr > 255)
901 {
902 result = 0;
903 return false;
904 }
905 result = (byte)(nuint)uIntPtr;
906 return true;
907 }
908 ThrowHelper.ThrowNotSupportedException();
909 result = 0;
910 return false;
911 }