Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Annotated program -- Keyboard shortcut: 't'    generics/string/app-3.cs - An equivalent program without automatic inference of the actual type parameters.Lecture 11 - slide 18 : 21
Program 2

using System;

class StringApp{

  public static void Main(){  
    ReportCompare<int>(new String<int>(), new String<int>(1));             
    ReportCompare<int>(new String<int>(1), new String<int>(1));            
    ReportCompare<int>(new String<int>(1,2,3), new String<int>(1));        
    ReportCompare<bool>(new String<bool>(false), 
                        new String<bool>(false, true, false));        
    ReportCompare<bool>(new String<bool>(true, true, false), 
                        new String<bool>(true, true, false));    

  public static void ReportCompare<T>(String<T> s, String<T> t)
    where T: IComparable<T>{
    Console.WriteLine("Result of comparing {0} and {1}: {2}", 
                      s, t, s.CompareTo(t));