Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wtol equivalent in C#

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.

like image 971
Tyler Durden Avatar asked Dec 13 '25 23:12

Tyler Durden


1 Answers

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
like image 50
heijp06 Avatar answered Dec 15 '25 11:12

heijp06



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!