I have this chunk of code
long num = Int64.Parse(Convert.ToString(random.Next(0, 65535), 2).PadLeft(16, '0'))
When using this code the string is not padded with the leading zeros. I'm not sure, but my guess is maybe when the string is parsed it removes the leading zeros from some reason?
If I do something like this
long num = Int64.Parse(Convert.ToString(random.Next(0, 65535), 2).PadLeft(16, '8'))
or any number that isn't zero, it will come out correctly to 16 digits with leading 8's.
Is there a good explanation to why this is happening?
Also is there a quick easy fix?
This is not a duplicate of anything using int.ToString("D16")
or anything of that sort. I believe this is a unique problem.