[C#], Another direct solution and with string convert
\npublic class Solution {\n    public long SmallestNumber(long num) {\n        long res = 0;\n        var digits = new List<long>();\n        while (num != 0) {
```\npublic class Solution {\n    public long SmallestNumber(long num) {\n        long res = 0;\n        var digits = new List<long>();\n        while (num != 0) {\n            digits.Add(num % 10);\n            num /= 10;\n        }\n        digits.Sort();\n        int zeroCnt = digits.Count(r => r == 0);\n        for (int i = 0; i < digits.Count; i++) {\n            if (zeroCnt > 0 && digits[i] > 0) {\n                res += digits[i];\n                res *= (long)Math.Pow(10, zeroCnt);\n                zeroCnt = 0;\n            } else res = res * 10 + digits[i];\n        }\n        return res;\n    }\n}\n```\n\n**Solution with converting to String:**\n```\npublic class Solution {\n    public long SmallestNumber(long num) {\n        char[] chars = Math.Abs(num).ToString().ToCharArray();\n        if (num <= 0) {\n            Array.Sort(chars, (a, b) => b - a);\n            return Convert.ToInt64(new string(chars)) * (-1);\n        }\n        Array.Sort(chars);\n        int it = Array.FindIndex(chars, r => r != \'0\');\n        char tmp = chars[0];\n        chars[0] = chars[it];\n        chars[it] = tmp;\n        return Convert.ToInt64(new string(chars));\n    }\n}\n```
['String']