709 {
710 if (typeof(TOther) == typeof(byte))
711 {
712 result = (byte)(
object)
value;
713 return true;
714 }
715 if (typeof(TOther) == typeof(char))
716 {
717 result = (char)(
object)
value;
718 return true;
719 }
720 if (typeof(TOther) == typeof(decimal))
721 {
722 decimal num = (decimal)(
object)
value;
723 if (num < 0m || num > 18446744073709551615m)
724 {
725 result = 0uL;
726 return false;
727 }
728 result = (ulong)num;
729 return true;
730 }
731 if (typeof(TOther) == typeof(double))
732 {
733 double num2 = (double)(
object)
value;
734 if (num2 < 0.0 || num2 > 1.8446744073709552
E+19)
735 {
736 result = 0uL;
737 return false;
738 }
739 result = (ulong)num2;
740 return true;
741 }
742 if (typeof(TOther) == typeof(short))
743 {
745 if (num3 < 0)
746 {
747 result = 0uL;
748 return false;
749 }
750 result = (ulong)num3;
751 return true;
752 }
753 if (typeof(TOther) == typeof(int))
754 {
755 int num4 = (int)(
object)
value;
756 if (num4 < 0)
757 {
758 result = 0uL;
759 return false;
760 }
761 result = (ulong)num4;
762 return true;
763 }
764 if (typeof(TOther) == typeof(long))
765 {
766 long num5 = (long)(
object)
value;
767 if (num5 < 0)
768 {
769 result = 0uL;
770 return false;
771 }
772 result = (ulong)num5;
773 return true;
774 }
775 if (typeof(TOther) == typeof(IntPtr))
776 {
778 if ((nint)intPtr < 0)
779 {
780 result = 0uL;
781 return false;
782 }
783 result = (ulong)(nint)intPtr;
784 return true;
785 }
786 if (typeof(TOther) == typeof(sbyte))
787 {
788 sbyte b = (sbyte)(
object)
value;
789 if (b < 0)
790 {
791 result = 0uL;
792 return false;
793 }
794 result = (ulong)b;
795 return true;
796 }
797 if (typeof(TOther) == typeof(float))
798 {
799 float num6 = (float)(
object)
value;
800 if (num6 < 0f || num6 > 1.8446744
E+19f)
801 {
802 result = 0uL;
803 return false;
804 }
805 result = (ulong)num6;
806 return true;
807 }
808 if (typeof(TOther) == typeof(ushort))
809 {
810 result = (ushort)(
object)
value;
811 return true;
812 }
813 if (typeof(TOther) == typeof(uint))
814 {
815 result = (uint)(
object)
value;
816 return true;
817 }
818 if (typeof(TOther) == typeof(ulong))
819 {
820 result = (ulong)(
object)
value;
821 return true;
822 }
823 if (typeof(TOther) == typeof(UIntPtr))
824 {
825 result = (ulong)(UIntPtr)(object)
value;
826 return true;
827 }
828 ThrowHelper.ThrowNotSupportedException();
829 result = 0uL;
830 return false;
831 }