Need help converting js to C#

I am new to Unity and i am trying to convert the CharacterControl script from the book “Unity 3 Game Development Hotshot”.
I have most of it but am having trouble with two things

JS - var v3_movement : Vector3 = (v3_moveDirection * f_moveSpeed) + Vector3 (0, f_verticalSpeed, 0);

C# - Vector3 v3_movement = (v3_moveDirection * f_moveSpeed) + Vector3 (0, f_verticalSpeed, 0);

The error i get is Expression denotes a type', where a variable’, value' or method group’ was expected

jS -
public function IsGrounded () : boolean
{
return (c_collisionFlags & CollisionFlags.CollidedBelow);
}

C#
public bool IsGrounded()
{
return (c_collisionFlags & CollisionFlags.CollidedBelow);
}
the error here is Cannot implicitly convert type UnityEngine.CollisionFlags' to bool’

Any suggestions greatly appreciated

Cheers

new Vector3 (0, f_verticalSpeed, 0)

instead of

Vector3 (0, f_verticalSpeed, 0)

return (c_collisionFlags & CollisionFlags.CollidedBelow != 0)

instead of

return (c_collisionFlags & CollisionFlags.CollidedBelow)

You’re missing the ‘new’ keyword:

Vector3 v3_movement = (v3_moveDirection * f_moveSpeed) + new Vector3 (0, f_verticalSpeed, 0);

The second one is more tricky. The & in c# is a bitwise AND. I’m not sure if it’s the same in java (I suspect it is). Clearly ‘CollisionFlags.CollidedBelow’ isn’t a boolian object and I can’t see what type it is so it’s hard to help here.

Ahh I think I have it.

return (c_collisionFlags & CollisionFlags.CollidedBelow) != 0

instead of

return (c_collisionFlags & CollisionFlags.CollidedBelow != 0)

Thanks for your help

This one works with C#.

public bool IsGrounded() { 
	return (controller.collisionFlags == CollisionFlags.Below); 
}

Although it seems that there is something wrong with the using of “&”. Even the Unity documentation

suggests the using of “&” with C# but it gives the error that you mentioned.