Elapsed Time is usec or msec

How does one get elapsed time?

For example to time sections of code?

Sorry, should have read more. I used button pressed to have elapsed time.

      
 void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            TimeSpan elapsed = DateTime.Now - start;
            double dt = (double)elapsed.Seconds + ((double)elapsed.Milliseconds)/1000.0;
            display.SimpleGraphics.DisplayText("Elapsed = "+dt.ToString(), MyFont, Colors.White, 0, yloc);
            yloc += (uint)MyFont.Height;
            if (yloc >= 20 * (uint)MyFont.Height)
            {
                yloc = 0;
                display.SimpleGraphics.Clear();
            }
            button.ToggleLED();
        }

DateTime Members | Microsoft Learn is the definitive reference for datetime.