Search code examples
c#.netclr

How can I see the source code of System.Math.Sin?


In this link, we can see the source code of System.Math class. But I cannot find the source code of how sine is defined.

Is there anything I am missing here?


Solution

  • The signature of the method is:

      [System.Security.SecuritySafeCritical]  // auto-generated
      [ResourceExposure(ResourceScope.None)]
      [MethodImplAttribute(MethodImplOptions.InternalCall)]
      public static extern double Sin(double a);
    

    The extern in the method means it is defined elsewhere. In this case, it will be implemented directly in the CLR (probably written in C or Assembly) which means there is no .NET implementation available.