I am translating some code from C++ to C# and there is a function wtol which takes a string input and outputs an integer. Specifically, it takes version string 6.4.0.1 and converts that to 4. How do I do that in C#? I tried convert.toInt32 but it failed miserably.
You could use (requires .Net 4.0 or higher)
Version.Parse("6.4.0.1").Minor
This will work pre .Net 4.0
new Version("6.4.0.1").Minor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With