Useful Bitconverter.

Source: Internet
Author: User

Certainly useful to the conversion, recorded down.

 ///Double =>ieee754            DoubleD =0.12345; byte[] IEEE754 =Bitconverter.getbytes (d);             Console.WriteLine (Bitconverter.tostring (IEEE754)); //IEEE754 convert to double            DoubleDr = Bitconverter.todouble (IEEE754,0); Console.WriteLine (Dr.             ToString ()); //Double ==>long//another form of representation of IEEE 754            LongL =Bitconverter.doubletoint64bits (d); Console.WriteLine (Convert.ToString (L, -)); intInteger =Ten; byte[] Finteger =bitconverter.getbytes (integer);            Console.WriteLine (Bitconverter.tostring (Finteger)); Const stringFormatter ="{0,25}{1,30}"; floatAsingl =0.1111111111111111111F; Longalong =1111111111111111111; intAnint =1111111111;  ShortAshort =11111; CharAchar ='*'; BOOLAbool =true; DoubleAdoubl =0.1111111111111111111; Console.WriteLine ("This example of methods of the Bitconverter class"+"\ngenerates the following output.\n"); Console.WriteLine (Formatter,"argument","byte array"); Console.WriteLine (Formatter,"--------","----------"); //Convert values to Byte arrays and display them.Console.WriteLine (Formatter, Adoubl, Bitconverter.tostring (Bitconverter.getbytes (ADOUBL)));            Console.WriteLine (Formatter, Asingl, Bitconverter.tostring (Bitconverter.getbytes (ASINGL)));            Console.WriteLine (Formatter, along, Bitconverter.tostring (Bitconverter.getbytes (along)));            Console.WriteLine (Formatter, Anint, Bitconverter.tostring (Bitconverter.getbytes (Anint)));            Console.WriteLine (Formatter, Ashort, Bitconverter.tostring (Bitconverter.getbytes (Ashort)));            Console.WriteLine (Formatter, Achar, Bitconverter.tostring (Bitconverter.getbytes (Achar)));            Console.WriteLine (Formatter, Abool, Bitconverter.tostring (Bitconverter.getbytes (Abool))); Console.read ();

The result of the above operation

Useful Bitconverter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.