I am a little programmer in C # , VB.NET do however have to code a lot of time . Now I was in doubt if the code was doing well . I need your help to create a function that makes the return of a string , already tested the following code , but the compiler gives an error :
public class Main
{
private System.Text.UTF8Encoding enc;
private ICryptoTransform encryptor;
private ICryptoTransform decryptor;
public string utf16_encrypt(string input)
{
string sPlainText = input;
string output;
if (!string.IsNullOrEmpty(sPlainText))
{
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, this.encryptor, CryptoStreamMode.Write);
cryptoStream.Write(enc.GetBytes(sPlainText), 0, sPlainText.Length);
cryptoStream.FlushFinalBlock();
output = Convert.ToBase64String(memoryStream.ToArray());
memoryStream.Close();
cryptoStream.Close();
return output;
}
}
}
The error given by the compiler is :

usingstatement where you make anew MemmoryStreamand anew CryptoStream. Not related to your question, but strongly encouraged.