Exemplo n.º 1
0
    public static void Main(String[] args)
    {
        Arbiter <String> csNames = new Arbiter <String>(new CaseSensitive());

        csNames.Consider("Apple");
        csNames.Consider("aardvark");
        Console.WriteLine(csNames.Best());      // Apple

        Arbiter <String> ciNames = new Arbiter <String>(new CaseInsensitive());

        ciNames.Consider("Apple");
        ciNames.Consider("aardvark");
        Console.WriteLine(ciNames.Best());      // aardvark

        Arbiter <int> OKinCsharp;
    }
Exemplo n.º 2
0
    public static void Main(String[] args)
    {
        Arbiter <String> csNames =
            new Arbiter <String>(new Chooser <String>(CaseSensitive));

        csNames.Consider("Apple");
        csNames.Consider("aardvark");
        Console.WriteLine(csNames.Best());      // Apple

        Arbiter <String> ciNames =
            new Arbiter <String>(new Chooser <String>(CaseInsensitive));

        ciNames.Consider("Apple");
        ciNames.Consider("aardvark");
        Console.WriteLine(ciNames.Best());      // aardvark

        // Note that the CLI virtual machine is aware of CSharp generics --
        // reflection works:
        Console.WriteLine(csNames.GetType().ToString());
    }