how to know the slope of terrain in Unity when I program with C#

I want to build a FPS controller defined by myself with C#, so I want to know the slope of the terrain. Then
I can calculate the motion . Is there some function to get the value of the slope?

If you know the normal vector of the surface you’re standing on from a raycast, you can get the slope with:

float FindSurfaceSlope (Vector3 surfNormal) {
    return Vector3.Angle (surfNormal, Vector3.up);
}