本文介绍了由于保护级别,无法访问system.linq.strings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private byte[] CreateKey(string strPassword) { //Convert strPassword to an array and store in chrData. char[] chrData = strPassword.ToCharArray(); //Use intLength to get strPassword size. int intLength = chrData.GetUpperBound(0); //Declare bytDataToHash and make it the same size as chrData. byte[] bytDataToHash = new byte[intLength + 1]; //Use For Next to convert and store chrData into bytDataToHash. for (int i = 0; i <= chrData.GetUpperBound(0); i++) { bytDataToHash[i] = Convert.ToByte(Strings.Asc(chrData[i])); }
推荐答案
类似的声音正在运行.Net网站,而无需确保已安装.Net 3.5.除此之外,更好的方法是这样的: Sounds like you''re running a .Net website without making sure .Net 3.5 is installed. Beyond that, a better way to do that is like so: bytDataToHash = Encoding.Unicode.GetBytes(strPassword);
您不需要一次做一个字符.
You don''t need to do it a character at a time.
更多推荐
由于保护级别,无法访问system.linq.strings
发布评论