EDN Admin
Well-known member
hello C# gurus,
i am trying to convert string to byte using this code, but it gives error pls help me..
<font color="#0000ff" size=2>
public</font><font size=2> </font><font color="#0000ff" size=2>static</font><font size=2> </font><font color="#0000ff" size=2>byte</font><font size=2>[] StringToByte(</font><font color="#0000ff" size=2>string</font><font size=2> InString) {
</font><font color="#0000ff" size=2>string</font><font size=2>[] ByteStrings;
ByteStrings = InString.Split(" ".ToCharArray());
</font><font color="#0000ff" size=2>byte</font><font size=2>[] ByteOut;
ByteOut = </font><font color="#0000ff" size=2>new</font><font size=2> </font><font color="#0000ff" size=2>byte</font><font size=2>[ByteStrings.Length-1];
</font><font color="#0000ff" size=2>for</font><font size=2> (</font><font color="#0000ff" size=2>int</font><font size=2> i = 0;i==ByteStrings.Length-1;i++) {
ByteOut<img src="/MSDN//emoticons/emotion-55.gif" alt=Idea> = Convert.ToByte(("0x" + ByteStrings<img src="/MSDN//emoticons/emotion-55.gif" alt=Idea>));
}
</font><font color="#0000ff" size=2>return</font><font size=2> ByteOut;
} </font>
View the full article
i am trying to convert string to byte using this code, but it gives error pls help me..
<font color="#0000ff" size=2>
public</font><font size=2> </font><font color="#0000ff" size=2>static</font><font size=2> </font><font color="#0000ff" size=2>byte</font><font size=2>[] StringToByte(</font><font color="#0000ff" size=2>string</font><font size=2> InString) {
</font><font color="#0000ff" size=2>string</font><font size=2>[] ByteStrings;
ByteStrings = InString.Split(" ".ToCharArray());
</font><font color="#0000ff" size=2>byte</font><font size=2>[] ByteOut;
ByteOut = </font><font color="#0000ff" size=2>new</font><font size=2> </font><font color="#0000ff" size=2>byte</font><font size=2>[ByteStrings.Length-1];
</font><font color="#0000ff" size=2>for</font><font size=2> (</font><font color="#0000ff" size=2>int</font><font size=2> i = 0;i==ByteStrings.Length-1;i++) {
ByteOut<img src="/MSDN//emoticons/emotion-55.gif" alt=Idea> = Convert.ToByte(("0x" + ByteStrings<img src="/MSDN//emoticons/emotion-55.gif" alt=Idea>));
}
</font><font color="#0000ff" size=2>return</font><font size=2> ByteOut;
} </font>
View the full article