Direction and Distance from One Object to Another

In the Unity manual it lists a method for getting the direction between two points

// Gets a vector that points from the player's position to the target's.
var heading = target.position - player.position;
var distance = heading.magnitude;
var direction = heading / distance; // This is now the normalized direction.

It looks like the example was done in javascript but I am using C# so I took that calculation and tried to apply it to my work:

// calculate slant angle
Vector3 originVector = new Vector3 (x1,y1,z);
Vector3 outerVector = new Vector3 (x2,y2,z);
Vector3 heading = originVector - outerVector;
float distance = heading.magnitude;

return heading/distance;

The problem I’m having is since magnitude is a float value and everything else is a Vector3 the types are not compatible. The example keeps the types generic but that doesn’t seem right as they are specifically talking about making calculations with Vectors.

So my question is how to I get this to work in C# as intended in the linked manual page. Am I just supposed to cast?

What is your function supposed to return?

Vector3 / float is defined: it returns a Vector3 (it divides each component, x,y,z, by the second argument). So this should work just fine. What error are you getting?