I think most of these points have been made in previous answers and comments, just wanted to put them together & summarize. Everyone should feel free to edit this.
public static class ExtensionClassName
{
static public Vector2 RotateAboutPoint(this Vector2 pointToRotate, Vector2 centerPoint, float angle)
{..blah..}
static public Vector2 RotateAboutPoint2(Vector2 pointToRotate, Vector2 centerPoint, float angle)
{..blah..}
static float favoriteAngle=30.0f;
}
Notice the two ways the RotateAboutPoint functions’ parameters are defined: the first one has the keyword “this” in front of it.
This is no more than a neat syntax trick, which allow this function to be CALLED like so:
pointToRotate.RotateAboutPoint(centerPoint, angle); //Where pointToRotate is a Vector2 variable.
This is functionally exactly the same as NOT using the “this” keyword, and calling the function like so:
ExtensionClassName.RotateAboutPoint2(pointToRoate, centerPoint,angle);
Either way, because these are static functions, you must pass in (or otherwise make accessible) ALL the information needed to compute the return value.
Other ways to make values accessible to static functions, is to store them in static variables. For example the static float favoriteAngle can be read and written by both RotateAboutPoint functions. It can ALSO be access ANYWHERE this class is available with:
ExtensionClassName.favoriteAngle
Limitations: the name of the static class holding these functios must be used, unless the “This” keyword is specified. Alas, the class names Vector2 and Vector3 and similar, are already defined, so we MUST use a unique class name here. this means we CANNOT define, for example, a function called like so: Vector2.RotateAboutPoint(pointToRoate, centerPoint,angle);