How to get all methods of Math Class in C#

1 Answer

0 votes
using System;
using System.Linq;
   
class Program
{
    static void ShowMethods(Type type) {
        foreach (var method in type.GetMethods()) {
            var parameterDescriptions = string.Join
                             (", ", method.GetParameters()
                             .Select(x => x.ParameterType + " " + x.Name)
                             .ToArray());
   
            Console.WriteLine("{0} {1}({2})",
                              method.ReturnType,
                              method.Name,
                              parameterDescriptions);
        }
    }
   
    static void Main() {
        ShowMethods(typeof(Math));
    }
}
   
   
   
/*
run:

System.Int16 Abs(System.Int16 value)
System.Int32 Abs(System.Int32 value)
System.Int64 Abs(System.Int64 value)
System.SByte Abs(System.SByte value)
System.Decimal Abs(System.Decimal value)
System.Int64 BigMul(System.Int32 a, System.Int32 b)
System.Int32 DivRem(System.Int32 a, System.Int32 b, System.Int32& result)
System.Int64 DivRem(System.Int64 a, System.Int64 b, System.Int64& result)
System.Decimal Ceiling(System.Decimal d)
System.Byte Clamp(System.Byte value, System.Byte min, System.Byte max)
System.Decimal Clamp(System.Decimal value, System.Decimal min, System.Decimal max)
System.Double Clamp(System.Double value, System.Double min, System.Double max)
System.Int16 Clamp(System.Int16 value, System.Int16 min, System.Int16 max)
System.Int32 Clamp(System.Int32 value, System.Int32 min, System.Int32 max)
System.Int64 Clamp(System.Int64 value, System.Int64 min, System.Int64 max)
System.SByte Clamp(System.SByte value, System.SByte min, System.SByte max)
System.Single Clamp(System.Single value, System.Single min, System.Single max)
System.UInt16 Clamp(System.UInt16 value, System.UInt16 min, System.UInt16 max)
System.UInt32 Clamp(System.UInt32 value, System.UInt32 min, System.UInt32 max)
System.UInt64 Clamp(System.UInt64 value, System.UInt64 min, System.UInt64 max)
System.Decimal Floor(System.Decimal d)
System.Double IEEERemainder(System.Double x, System.Double y)
System.Double Log(System.Double a, System.Double newBase)
System.Byte Max(System.Byte val1, System.Byte val2)
System.Decimal Max(System.Decimal val1, System.Decimal val2)
System.Double Max(System.Double val1, System.Double val2)
System.Int16 Max(System.Int16 val1, System.Int16 val2)
System.Int32 Max(System.Int32 val1, System.Int32 val2)
System.Int64 Max(System.Int64 val1, System.Int64 val2)
System.SByte Max(System.SByte val1, System.SByte val2)
System.Single Max(System.Single val1, System.Single val2)
System.UInt16 Max(System.UInt16 val1, System.UInt16 val2)
System.UInt32 Max(System.UInt32 val1, System.UInt32 val2)
System.UInt64 Max(System.UInt64 val1, System.UInt64 val2)
System.Byte Min(System.Byte val1, System.Byte val2)
System.Decimal Min(System.Decimal val1, System.Decimal val2)
System.Double Min(System.Double val1, System.Double val2)
System.Int16 Min(System.Int16 val1, System.Int16 val2)
System.Int32 Min(System.Int32 val1, System.Int32 val2)
System.Int64 Min(System.Int64 val1, System.Int64 val2)
System.SByte Min(System.SByte val1, System.SByte val2)
System.Single Min(System.Single val1, System.Single val2)
System.UInt16 Min(System.UInt16 val1, System.UInt16 val2)
System.UInt32 Min(System.UInt32 val1, System.UInt32 val2)
System.UInt64 Min(System.UInt64 val1, System.UInt64 val2)
System.Decimal Round(System.Decimal d)
System.Decimal Round(System.Decimal d, System.Int32 decimals)
System.Decimal Round(System.Decimal d, System.MidpointRounding mode)
System.Decimal Round(System.Decimal d, System.Int32 decimals, System.MidpointRounding mode)
System.Double Round(System.Double a)
System.Double Round(System.Double value, System.Int32 digits)
System.Double Round(System.Double value, System.MidpointRounding mode)
System.Double Round(System.Double value, System.Int32 digits, System.MidpointRounding mode)
System.Int32 Sign(System.Decimal value)
System.Int32 Sign(System.Double value)
System.Int32 Sign(System.Int16 value)
System.Int32 Sign(System.Int32 value)
System.Int32 Sign(System.Int64 value)
System.Int32 Sign(System.SByte value)
System.Int32 Sign(System.Single value)
System.Decimal Truncate(System.Decimal d)
System.Double Truncate(System.Double d)
System.Double Abs(System.Double value)
System.Single Abs(System.Single value)
System.Double Acos(System.Double d)
System.Double Acosh(System.Double d)
System.Double Asin(System.Double d)
System.Double Asinh(System.Double d)
System.Double Atan(System.Double d)
System.Double Atan2(System.Double y, System.Double x)
System.Double Atanh(System.Double d)
System.Double Cbrt(System.Double d)
System.Double Ceiling(System.Double a)
System.Double Cos(System.Double d)
System.Double Cosh(System.Double value)
System.Double Exp(System.Double d)
System.Double Floor(System.Double d)
System.Double Log(System.Double d)
System.Double Log10(System.Double d)
System.Double Pow(System.Double x, System.Double y)
System.Double Sin(System.Double a)
System.Double Sinh(System.Double value)
System.Double Sqrt(System.Double d)
System.Double Tan(System.Double a)
System.Double Tanh(System.Double value)
System.Boolean Equals(System.Object obj)
System.Int32 GetHashCode()
System.Type GetType()
System.String ToString()

*/

 



answered Sep 21, 2023 by avibootz

Related questions

1 answer 111 views
111 views asked Oct 17, 2023 by avibootz
1 answer 150 views
150 views asked Oct 14, 2023 by avibootz
1 answer 123 views
123 views asked Oct 13, 2023 by avibootz
1 answer 109 views
109 views asked Sep 26, 2023 by avibootz
1 answer 104 views
104 views asked Sep 23, 2023 by avibootz
1 answer 123 views
123 views asked Sep 22, 2023 by avibootz
1 answer 132 views
...