How to get the direction of object along axis

Say you want to get the direction an object is moving along an axis, and use it like “If object is moving right/left on X-axis, do something” (C#)

Getting it’s transform wouldn’t work as that could be a static number, correct? Does this call for some math?

Getting it’s transform and then getting it again after a frame or two would make for a simple comparison of the position.x