zoukankan      html  css  js  c++  java
  • C#中使用Buffer.BlockCopy()方法将string转换为byte array的方法:

    
    
     public static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count);
    将指定数目的字节从起始于特定偏移量的源数组复制到起始于特定偏移量的目标数组。


    ///
    <summary> /// C#中使用Buffer.BlockCopy()方法将string转换为byte array的方法 /// </summary> /// <param name="str"></param> /// <returns></returns> static byte[] GetBytes(string str) { byte[] bytes = new byte[str.Length * sizeof(char)]; Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); return bytes; }
  • 相关阅读:
    JSP介绍
    Cookie和Session的原理及异同
    过滤器的使用
    JAVA 集合
    **JVM** 类加载机制
    *JAVA IO/NIO*
    jvm
    ioc
    spring问题总结
    aop详解
  • 原文地址:https://www.cnblogs.com/ChineseMoonGod/p/5689526.html
Copyright © 2011-2022 走看看