Extend methods

Hi I am trying to create extend methodes for math class by adding a couple of Trigonometric formula I just want to see if I am in the right track or not
thank you



static class Trigonometric
    {
        private double m_hypotenuse_C;
        private double m_side1_A;
        private double m_side2_B;




        public Trigonometric()
        {
            // TODO: Complete member initialization
        }

        public Trigonometric(double side1, double side2)
        {
            m_side1_A = side1;
            m_side2_B = side2;
        }

        public Trigonometric(double hypotenuse, double side1_a, double side2_b)
        {
            m_hypotenuse_C = hypotenuse;
            m_side1_A = side1_a;
            m_side2_B = side2_b;
        }



        public double GetHypotenuse()
        {
            double side1 = Math.Pow(m_side1_A, 2);
            double side2 = Math.Pow(m_side2_B, 2);

            double totalOFsides = side1 + side2;

            return Math.Sqrt(totalOFsides);
        }


        static  double GetTriangleSide()
        {
            double hypotenuse = Math.Pow(m_hypotenuse_C, 2);

            double side = Math.Pow(m_side1_A, 2);

            double value = hypotenuse - side;

            return Math.Sqrt(value);
        }


        static  double GetTheta()
        {
            double theta;
            double result = m_side2_B / m_hypotenuse_C;
            return theta = Math.Asin(result);





        }

    }

You don’t really need extension methods here, you need to use both the public and the static keywords on your methods. Static classes cannot have instance (non-static) members.

For Math it seems to be impossible to create extensions. It is possible only for non-static types, which allow to create objects.


public static class Extensions
{
  public static double MyExtension(this string str, int arg)
  {
    ... put your logic here ...
  }
}

Make sure that you create a public static method in a public static class.