Comparison between Generic and Non-Generic Programs
Teacher starts the discussion: Generics
are one of the key concepts of C#. They came in C# 2.0, and since then, they have expanded with additional features.
To understand the power of generics
, we will start with a non-generic program and then write a generic program. Later, we will do a comparative analysis and then we will try to discover the advantages of generic programming. Consider the following program and the output.
Demonstration 1: A Non-Generic Program
using System;
namespace NonGenericEx
{
class NonGenericEx
{
public ...