sort0.cs

using sysCols = System.Collections;
using sysCon = System.Console;
using sysDia = System.Diagnostics;

class MainApp{
  public static void Main(){
    string[] cc = new string[] {"rossi", "Verdi", "bianco", "Nerone"};
    string[] nn = new string[] {"pino", "gino", "nino", "rino", "Pino", "GINO", "Gino"};
    
    // Dichiaro e popolo la collezione PhoneBook di tipo SortedList
    sysCols.SortedList PhoneBook = new sysCols.SortedList();
    for ( int i = cc.GetLowerBound(0); i <= cc.GetUpperBound(0); i++ )
      for ( int j = nn.GetLowerBound(0); j <= nn.GetUpperBound(0); j++ )
      {
        Person key = new Person(cc[i], nn[j]);
        PhoneNumber item = new PhoneNumber(0431 + i,  123450 + (10*i) + j);
        PhoneBook.Add(key, item);
      }

    return;
  }
}
class PhoneNumber{
  private int prefisso;
  private int numero;

  public PhoneNumber(int prefisso, int numero){
    this.prefisso = prefisso;
    this.numero = numero;
  }
  public int Prefisso{
    get{return prefisso;}
  }
  public int Numero{
    get{return numero;}
  }
}

class Person{
  private readonly string nome;
  private readonly string cognome;

  public Person(string cognome, string nome){
    this.cognome = cognome;
    this.nome = nome;
  }

  public string Cognome{
    get {return cognome;}
  }

  public string Nome{
    get {return nome;}
  }  
}