Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

.NET Standard 2.0 equivalent of Int128Converter

I have this C# code:

string x = "0x0000000000000000000000000000000000000000000000056bc75e2d63100000";
new System.ComponentModel.Int128Converter().ConvertFromString(x).Dump();

It works in my .NET 8 project. I cannot use it in my .NET Standard 2.0 Xamarin Forms project. What is the equivalent?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your question doesn’t make sense, it’s not about what function to use, it’s about the fact that there is no Int128 type in .Net Standard 2.0. Even if you wrote your own parsing function, there wouldn’t be a type to smush it into.

So you either use it as a string (for example, to display), or use BigInteger to use it in arithmetical operations, albeit at a very large performance penalty.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading