Code
The string variable is defined as STR, the memory stream variable is ms, and the bit array is BT.
1. String to bits Array
(1)Byte[] BT=System. Text. encoding. Default. getbytes ("String");
(2)Byte[] BT=Convert. frombase64string ("String");
2. String streaming
(1Memorystream MS=NewMemorystream (system. Text. encoding. Default. getbytes ("String"));
(2Memorystream MS=NewMemorystream (convert. frombase64string ("String"));
3. Flow bits Array
(1)Byte[] BT=Ms. toarray ();
(2Memorystream MS=NewMemorystream (); Ms. Write (BT,0, Ms. Length );
4. Flow String
(1)StringStr=Convert. tobase64string (Ms. toarray ());
(2)StringStr=System. Text. encoding. Default. getstring (Ms. toarray ());
5. Bit Array to string
(1)StringStr=System. Text. encoding. Default. getstring (BT );
(2)StringStr=Convert. tobase64string (BT );
6. Bit Array streaming
(1Memorystream MS=NewMemorystream (BT );
(2Memorystream MS=NewMemorystream (); Ms. Read (BT,0, BT. lenght );