Hi Guys,

I am trying to translate some functions from VBA to C# for a project but i got stuck on some error and I can't find anything on google to help me.

The first error is in the part highlighted with bold. In the if statement i am trying to check : if ((first > 31) or (bytes.Length = 1)) then do stuff. But i get the error operand cannot be applied to types bool or int.
Quote Originally Posted by code
public string Decrypt(byte[] bytes)
{
int first, a,s,x,z;
StringBuilder result;
int position = 2;
bool skip = false;

if(bytes == null)
{
throw new ArgumentNullException("bytes");
}
if(bytes.Length == 0)
{
return string.Empty;
}

result = new StringBuilder(bytes.Length + 8);
first = bytes[0];
if ((first > 31) & (bytes.Length = 1))
{
foreach (byte item in bytes)
{
result.Append(Strings.Chr(item));
}
}
else
The second is is this: - the error is cannot assign to 'cript' because is a method group.
Quote Originally Posted by code
public string cript(string strToCript)
{
Int16[] ent = { 0, 10, 21, 31, 3, 14, 26, 24, 23, 16, 12, 8, 27, 17, 28, 1, 5, 2, 30, 7, 18, 29, 9, 4, 13, 6, 20, 19, 22, 25, 11, 15 };
Int16[] usc = { 0, 11, 25, 22, 19, 20, 6, 13, 4, 9, 29, 18, 7, 30, 2, 1, 15, 28, 17, 27, 8, 12, 16, 23, 24, 26, 14, 3, 31, 21, 10, 5 };
string c6 = Strings.Chr(216).ToString();
string p = string.Empty;

int x, z, r, a, s;
string w2 = string.Empty;

if (strToCript == string.Empty)
{
cript = string.Empty;
return cript;

}
if(Strings.Asc(Strings.Mid(strToCript,1,1)) == 255)
{
cript = strToCript;
return cript;

}
The 3rd and the last one is: - a new expression requires (),[] or{} after type.
Quote Originally Posted by code
Random random = new Random
x = Convert.ToInt32(random.Next() * 1000);
Do you guys have any idea how to solve this errors?