<legend id='fzOqd'><style id='fzOqd'><dir id='fzOqd'><q id='fzOqd'></q></dir></style></legend>

        <i id='fzOqd'><tr id='fzOqd'><dt id='fzOqd'><q id='fzOqd'><span id='fzOqd'><b id='fzOqd'><form id='fzOqd'><ins id='fzOqd'></ins><ul id='fzOqd'></ul><sub id='fzOqd'></sub></form><legend id='fzOqd'></legend><bdo id='fzOqd'><pre id='fzOqd'><center id='fzOqd'></center></pre></bdo></b><th id='fzOqd'></th></span></q></dt></tr></i><div id='fzOqd'><tfoot id='fzOqd'></tfoot><dl id='fzOqd'><fieldset id='fzOqd'></fieldset></dl></div>
      1. <tfoot id='fzOqd'></tfoot>

        <small id='fzOqd'></small><noframes id='fzOqd'>

        • <bdo id='fzOqd'></bdo><ul id='fzOqd'></ul>

        将二进制字符串表示形式转换为字节数组

        时间:2023-06-03
            <tbody id='MNGcq'></tbody>

          <legend id='MNGcq'><style id='MNGcq'><dir id='MNGcq'><q id='MNGcq'></q></dir></style></legend>
        • <tfoot id='MNGcq'></tfoot>
        • <small id='MNGcq'></small><noframes id='MNGcq'>

            • <bdo id='MNGcq'></bdo><ul id='MNGcq'></ul>
              1. <i id='MNGcq'><tr id='MNGcq'><dt id='MNGcq'><q id='MNGcq'><span id='MNGcq'><b id='MNGcq'><form id='MNGcq'><ins id='MNGcq'></ins><ul id='MNGcq'></ul><sub id='MNGcq'></sub></form><legend id='MNGcq'></legend><bdo id='MNGcq'><pre id='MNGcq'><center id='MNGcq'></center></pre></bdo></b><th id='MNGcq'></th></span></q></dt></tr></i><div id='MNGcq'><tfoot id='MNGcq'></tfoot><dl id='MNGcq'><fieldset id='MNGcq'></fieldset></dl></div>
                  本文介绍了将二进制字符串表示形式转换为字节数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  如何将诸如01110100011001010111001101110100"之类的字符串转换为字节数组,然后使用 File.WriteAllBytes 使确切的二进制字符串是文件的二进制文件.在这种情况下,它将是文本test".

                  How do you convert a string such as "01110100011001010111001101110100" to a byte array then used File.WriteAllBytes such that the exact binary string is the binary of the file. In this case it would be the the text "test".

                  推荐答案

                  如果你没有这个最近很常见的LINQ迷信,你可以试试正常的方法

                  In case you don't have this LINQ fetish, so common lately, you can try the normal way

                  string input ....
                  int numOfBytes = input.Length / 8;
                  byte[] bytes = new byte[numOfBytes];
                  for(int i = 0; i < numOfBytes; ++i)
                  {
                      bytes[i] = Convert.ToByte(input.Substring(8 * i, 8), 2);
                  }
                  File.WriteAllBytes(fileName, bytes);
                  

                  LINQ 很棒,但必须有一些限制.

                  LINQ is great but there must be some limits.

                  这篇关于将二进制字符串表示形式转换为字节数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Kinect:我如何识别第一个跟踪的骨架并在之后用它 下一篇:使用 Entity Framework 6 从 SQL Server 保存和检索图像

                  相关文章

                  最新文章

                  <i id='SQewU'><tr id='SQewU'><dt id='SQewU'><q id='SQewU'><span id='SQewU'><b id='SQewU'><form id='SQewU'><ins id='SQewU'></ins><ul id='SQewU'></ul><sub id='SQewU'></sub></form><legend id='SQewU'></legend><bdo id='SQewU'><pre id='SQewU'><center id='SQewU'></center></pre></bdo></b><th id='SQewU'></th></span></q></dt></tr></i><div id='SQewU'><tfoot id='SQewU'></tfoot><dl id='SQewU'><fieldset id='SQewU'></fieldset></dl></div>

                    • <bdo id='SQewU'></bdo><ul id='SQewU'></ul>

                  1. <small id='SQewU'></small><noframes id='SQewU'>

                      <legend id='SQewU'><style id='SQewU'><dir id='SQewU'><q id='SQewU'></q></dir></style></legend>
                      <tfoot id='SQewU'></tfoot>