22 Ağu

C# Calculate Execution Time

This example shows how much time takes a procedure/function/code. It is useful for micro-benchmarks in code optimization. To do this, We use the Stopwatch class in System.Diagnostics namespace.

Sample Code:

            // Create stopwatch
            Stopwatch stopwatch = new Stopwatch();

            // Begin timing
            stopwatch.Start();

            // Do something
            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(10);
            }

            // Stop timing
            stopwatch.Stop();

            // Write result
            Console.WriteLine("Total Time: {0}", stopwatch.ElapsedMilliseconds);
16 Tem

Simple Bootstrap Tooltip

This example shows how to create a simple tooltip using bootstrap framework.

Firstly, you should add the following code to the head section in html:

  https://csharpexamples.com
  
  
  
  
  

SAMPLE USAGE:

    

RESULT:
bootstrap tooltip example

16 Tem

Bootstrap Alert Messages

This example shows how to use alert messages using bootstrap framework.

Firstly, you should add the following code to the head section in html:

  https://csharpexamples.com
  
  
  
  

SAMPLE USAGE:

    
× Success! Your message has been sent successfully.
× Warning! There was a problem with your network connection.
× Note! Please read the comments carefully.
× Error! A problem has been occurred while submitting your data.

RESULT:
bootstrap alert messages