2016-03-24 11 views
-1
byte[]cipherbytes = Encoding.ASCII.GetString(label6.Text); 
System.IO.MemoryStream ms = new System.IO.MemoryStream(cipherbytes); 
+0

をバイトに文字列値を格納する方法は? – Sam7382

+0

そのために申し訳ありませんが、私はそれを覚えておきます... – Sam7382

答えて

0

は、特定のエンコーディングで文字列をエンコードしないGetString()、上Encoding.<YourEncoding>.GetBytes()を呼び出すにはそれを行うために、バイト[] cipherbytes..howでlabel6.text値を格納したい、この関数は、指定したstringを返すためですその表現はbyte[]です。可能な符号化は、例えば、 ASCIIまたはUTF8エンコーディングです。

byte[] cipherbytes = System.Text.Encoding.ASCII.GetBytes(label6.Text); 

も参照してください:How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Encoding.ASCII.GetBytes()

+0

ありがとう......私はそれをチェックします..... – Sam7382