Showing posts with label c# generics. Show all posts
Showing posts with label c# generics. Show all posts

Saturday, 17 October 2015

C# program to check the performance of Generics.













This program shows the difference between Generics and Non-Generic . It checks the performance of Generics. Generics are faster than Non-Generics it takes less time to add and retrieve any type of values. Below program gives the demonstration on performance and shows how powerful is Generics.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;

namespace GenericsPerformance
{
    class Program
    {
        static void Main(string[] args)
        {
            NonGenericMethod();
            GenericMethods();
        }