public static void Write(this MenuSuiteNode node, CSideWriter writer) { writer.Write("{ "); writer.Write(node.NodeTypeAsString()); writer.Write(";"); writer.Write("[{0}] ", node.ID.ToString("B").ToUpper()); writer.Write(";"); writer.Indent(writer.Column); IEnumerable <Property> properties = null; TypeSwitch.Do( node, TypeSwitch.Case <RootNode>(n => properties = n.Properties), TypeSwitch.Case <MenuNode>(n => properties = n.Properties), TypeSwitch.Case <GroupNode>(n => properties = n.Properties), TypeSwitch.Case <ItemNode>(n => properties = n.Properties), TypeSwitch.Case <DeltaNode>(n => properties = n.Properties) ); var relevantProperties = properties.Where(p => p.HasValue); relevantProperties.Write(PropertiesStyle.Field, writer); writer.Unindent(); writer.WriteLine("}"); }