Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 将位字符串数组转换为字节数组_Vb.net_Reporting Services - Fatal编程技术网

Vb.net 将位字符串数组转换为字节数组

Vb.net 将位字符串数组转换为字节数组,vb.net,reporting-services,Vb.net,Reporting Services,我有下面的二进制字符串,实际上是一个位数组 1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0 我想把它转换成字节数组。 我需要一个嵌入式报告代码函数,它只接受一个字节数组。我已从powershell转换此函数 我找到了这个,但它是C string source = "1,1,1,0,0"; byte[] result = source .Split(',') .Select(item => byte.Parse(item)) .ToArray(); 这

我有下面的二进制字符串,实际上是一个位数组 1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0

我想把它转换成字节数组。 我需要一个嵌入式报告代码函数,它只接受一个字节数组。我已从powershell转换此函数

我找到了这个,但它是C

string source = "1,1,1,0,0";

 byte[] result = source
   .Split(',')
   .Select(item => byte.Parse(item))
   .ToArray();
这在报表生成器中不起作用“Select”不是“System.Array”的成员

将源变暗为字符串=1,1,1,0,0 Dim结果为Byte=source.Split,c.[选择]函数项Byte.Parseitem.ToArray 如果我按照建议添加System.Linq,我仍然会收到一个错误: “Select”不是“Linq”的成员

作为字符串的Dim源=1,1,1,0,0。拆分,c Dim结果为Byte=System.Linq.SelectFunctionsource Byte.Parsesource.ToArray
在更仔细地研究函数之后,我意识到输入可以是任何数组,因此我将数组的类型修改为string,并相应地更新了输入。谢谢你们的帮忙

作用

函数GetSQLProductKeyByVal AstBinaryKey作为字符串,ByVal intVersion作为整数作为字符串 Dim achrKeyChars As Char={B,C,D,F,G,H,J,K,M,P,Q,R,T,V,W,X,Y,2,3,4,6,7,8,9} 将strSQLProductKey设置为字符串 Dim iastrBinaryKey的长度为 暗淡的iachrKeyChars与长 Dim iastrBinaryKeyOuterLoop尽可能长 Dim iastrBinaryKeyInnerLoop尽可能长 尝试 如果intVersion>=11,则 iastrBinaryKey=0 其他的 iastrBinaryKey=52 如果结束 对于iastrBinaryKeyOuterLoop=24到0,步骤-1 iachrKeyChars=0 对于iastrBinaryKeyInnerLoop=14到0步骤-1 iachrKeyChars=iachrKeyChars*256异或AstBinaryKeyIASTRBinaryKeyInnerLoop+iastrBinaryKey AstBinaryKeyIAstrBinaryKeyInnerLoop+iastrBinaryKey=Math.truncateAchRkeyChars/24 iachrKeyChars=iachrKeyChars模块24 下一个iastrBinaryKeyInnerLoop strSQLProductKey=achrKeyCharsiachrKeyChars+strSQLProductKey 如果iastrBinaryKeyOuterLoop Mod 5=0且iastrBinaryKeyOuterLoop为0,则 strSQLProductKey=-+strSQLProductKey 如果结束 下一个iastrBinaryKeyOuterLoop 接住 strSQLProductKey=无法解码产品密钥。 结束尝试 GetSQLProductKey=strSQLProductKey 端函数 函数调用SSRS

Code.GetSQLProductKeySplitReplaceFields!ProductKey.Value、、、左字段!版本。值,2
我投票结束这个问题,因为这只是一个隐晦的代码转换请求。有很多在线工具可以执行这项服务。@TnTinMn,我没有看到任何面纱。你可以用它将VB转换为C或C转换为VB。谢谢@TnTinMn,你帮了大忙。如果你费心阅读本文,你会发现我在没有任何人帮助的情况下从powershell转换了整个函数。所以我看不到任何面纱。我只是想得到一些帮助,因为reporting services不理解任何非字符串的内容。@Han很抱歉,我没有指定这一点,但我使用了一个转换器。不幸的是,代码没有正确转换。