C# Solution
C# solutin based on this explanation https://leetcode.com/problems/kth-smallest-product-of-two-sorted-arrays/solutions/1524856/binary-search-with-detailed-expla
C# solutin based on this explanation https://leetcode.com/problems/kth-smallest-product-of-two-sorted-arrays/solutions/1524856/binary-search-with-detailed-explanation/\n\n# Code\n```\npublic class Solution {\n    public long KthSmallestProduct(int[] nums1, int[] nums2, long k) {\n        var a1 = nums1.Where(x => x < 0).ToArray();\n        a1 = rev(inv(a1));\n        var a2 = nums1.Where(x => x >= 0).ToArray();\n        var b1 = nums2.Where(x => x < 0).ToArray();\n        b1 = rev(inv(b1));\n        var b2 = nums2.Where(x => x >= 0).ToArray();\n\n        var negCount = a1.Length * b2.Length + b1.Length * a2.Length;\n\n        var sign = 1;\n\n        if (k > negCount)\n        {\n            k -= negCount;\n        }\n        else\n        {\n            k = negCount - k + 1;\n            var temp = b1;\n            b1 = b2;\n            b2 = temp;\n            sign = -1;\n        }\n\n\n        var lo = 0L;\n        var hi = 10000000000L;\n\n        while (lo < hi)\n        {\n            var mid = (lo + hi) / 2;\n            var count = CountProductsSmallerOrEqualToNumber(mid, a1, b1)\n             + CountProductsSmallerOrEqualToNumber(mid, a2, b2);\n            Console.WriteLine($"guess: {mid}. count: {count}");\n            if (count >= k)\n            {\n                hi = mid;\n            }\n            else\n            {\n                lo = mid + 1;\n            }\n        }\n        return sign * lo;\n    }\n\n    public long CountProductsSmallerOrEqualToNumber(long number, int[] nums1, int[] nums2)\n    {\n        var count = 0L;\n        var j = nums2.Length - 1;\n        for (int i = 0; i < nums1.Length && j >= 0; i++)\n        {\n            while (j >= 0 && (long)nums1[i] * (long)nums2[j] > number)\n            {\n                j--;\n            }\n            count += j + 1;\n\n        }\n        return count;\n    }\n\n    public int[] inv(int[] nums)\n    {\n        for(int i = 0; i < nums.Length; i++)\n        {\n            nums[i] = -nums[i];\n\n        }\n        return nums;\n\n    }\n\n    public int[] rev(int[] nums)\n    {\n        for (int l = 0, r = nums.Length - 1; l < r; l++, r--)\n        {\n            nums[l] ^= nums[r];\n            nums[r] ^= nums[l];\n            nums[l] ^= nums[r];\n        }\n        return nums;\n    }\n}\n```
['C#']