mercredi 31 mai 2017

Does the following way of creating static methods of `Console` from `TextReader` and `TextWriter` use some design pattern(s)?

System.Console.In is instance of TextReader, and System.Console.Out and System.Console.Error are instances of TextWriter.

The static IO methods of Console just call the equivalent methods on the Console.In and Console.Out TextWriter properties http://ift.tt/2rDNJra

public static int ReadLine()
{
    return In.ReadLine();
}

public static void WriteLine()
{
    Out.WriteLine();
}

Does the above way of creating static methods of Console from TextReader and TextWriter use some design pattern(s)?

I am asking that, because TextReader and TextWriter are created from streams using design pattern "Adapters".

Thanks.

Aucun commentaire:

Enregistrer un commentaire