O'Reilly logo

C# 3.0 Entwurfsmuster by Judith Bishop

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beispielcode für das Interpreter-Muster – Kursregeln

Dies ist Code für ein Beispiel des Interpreter-Musters:

using System; // Interpreter-Muster - Beispiel Judith Bishop Okt 2007 // Erzeugt eine Objektstruktur und interpretiert sie mit gegebenen Daten static class ElementExtensions { public static string gap; public static void Print(this Element element) { Console.WriteLine(gap+element + " " + element.Weight); if (element.Part!=null) { gap+=" "; Print(element.Part.Next); gap = gap.Substring(2); } if (element.Next!=null) Print(element.Next); } public static int Lab {get; set;} public static int Test {get; set;} public static void Summarize(this Element element) { if (element is Lab) Lab += element.Weight; else if (element is Test) Test += element.Weight; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required