\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Kemmojoo} \pdfinfo{ /Title (see-sharp.pdf) /Creator (Cheatography) /Author (Kemmojoo) /Subject (See Sharp Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{1392D1} \definecolor{LightBackground}{HTML}{F0F8FC} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{See Sharp Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Kemmojoo} via \textcolor{DarkBackground}{\uline{cheatography.com/28261/cs/8310/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Kemmojoo \\ \uline{cheatography.com/kemmojoo} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 31st May, 2016.\\ Updated 31st May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Comments}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{// Single line \newline /{\emph{ Multiple \newline line }}/ \newline /// XML comments on single line \newline /{\emph{* XML comments on multiple lines }}/} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Enumerations}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{enum Action \{Start, Stop, Rewind, Forward\}; \newline enum Status \{Flunk = 50, Pass = 70, Excel = 90\}; \newline \newline Action a = Action.Stop; \newline if (a != Action.Start) \newline //Prints "Stop is 1" \newline \seqsplit{System.Console.WriteLine(a} + " is " + (int) a); \newline \newline // Prints 70 \newline System.Console.WriteLine((int) Status.Pass); \newline // Prints Pass \newline System.Console.WriteLine(Status.Pass); \newline \newline enum Weekdays\{ \newline Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Delegates / Events}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{delegate void \seqsplit{MsgArrivedEventHandler(string} message); \newline \newline event MsgArrivedEventHandler MsgArrivedEvent; \newline \newline //Delegates must be used with events in C\# \newline \newline MsgArrivedEvent += new MsgArrivedEventHandler \newline \seqsplit{(My\_MsgArrivedEventCallback);} \newline //Throws exception if obj is null \newline MsgArrivedEvent("Test message"); \newline MsgArrivedEvent -= new MsgArrivedEventHandler \newline \seqsplit{(My\_MsgArrivedEventCallback);} \newline \newline using System.Windows.Forms; \newline \newline Button MyButton = new Button(); \newline MyButton.Click += new \seqsplit{System.EventHandler(MyButton\_Click);} \newline \newline private void MyButton\_Click(object sender, System.EventArgs e) \{ \newline MessageBox.Show(this, "Button was clicked", "Info", \newline MessageBoxButtons.OK, \seqsplit{MessageBoxIcon.Information);} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Loops}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{//Pre-test Loops: while (i \textless{} 10) \newline i++; \newline for (i = 2; i \textless{} = 10; i += 2) \newline \seqsplit{System.Console.WriteLine(i);} \newline \newline \newline //Post-test Loop: \newline do \newline i++; \newline while (i \textless{} 10); \newline \newline // Array or collection looping \newline string{[}{]} names = \{"Steven", "SuOk", "Sarah"\}; \newline foreach (string s in names) \newline \seqsplit{System.Console.WriteLine(s);}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Objects}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{TopAuthor author = new TopAuthor(); \newline \newline //No "With" construct \newline author.Name = "Steven"; \newline author.AuthorRanking = 3; \newline \newline author.Rank("Scott"); \newline TopAuthor.Demote() //Calling static method \newline \newline TopAuthor author2 = author //Both refer to same object \newline author2.Name = "Joe"; \newline System.Console.WriteLine(author2.Name) //Prints Joe \newline \newline author = null //Free the object \newline \newline if (author == null) \newline author = new TopAuthor(); \newline \newline Object obj = new TopAuthor(); \newline if (obj is TopAuthor) \newline \seqsplit{SystConsole.WriteLine("Is} a TopAuthor object.");} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Namespaces}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{namespace \seqsplit{ASPAlliance.DotNet.Community} \{ \newline ... \newline \} \newline \newline // or \newline \newline namespace ASPAlliance \{ \newline namespace DotNet \{ \newline namespace Community \{ \newline ... \newline \} \newline \} \newline \} \newline \newline using \seqsplit{ASPAlliance.DotNet.Community;}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Program Structure}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{using System \newline Namespace MyNameSpace\{ \newline class HelloWorld \{ \newline static void Main(string{[}{]} args) \{ \newline \seqsplit{System.Console.WriteLine("Hello} World") \newline \} \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Console I/O}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{//Escape sequences \newline \textbackslash{}n, \textbackslash{}r \newline \textbackslash{}t \newline \textbackslash{}\textbackslash{} \newline \textbackslash{} \newline \newline Convert.ToChar(65) //Returns 'A' - equivalent to Chr(num) in VB \newline // or \newline (char) 65 \newline \newline System.Console.Write("What's your name? "); \newline string name = \seqsplit{SYstem.Console.ReadLine();} \newline System.Console.Write("How old are you? "); \newline int age = \seqsplit{Convert.ToInt32(System.Console.ReadLine());} \newline System.Console.WriteLine("\{0\} is \{1\} years old.", name, age); \newline //or \newline System.Console.WriteLine(name + " is " + age + " years old."); \newline \newline int c = System.Console.Read(); //Read single char \newline System.Console.WriteLine(c); //Prints 65 if user enters "A"} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Operators}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{//Comparison \newline == \textless{} \textgreater{} \textless{}= \textgreater{}= != \newline \newline //Arithmetic \newline + - {\emph{ / \newline \% (mod) \newline / (integer division if both operands are ints) \newline Math.Pow(x, y) \newline \newline //Assignment \newline = += -= }}= /= \%= \&= |= \textasciicircum{}= \textless{}\textless{}= \textgreater{}\textgreater{}= ++ -{}- \newline \newline //Bitwise \newline \& | \textasciicircum{} \textasciitilde{} \textless{}\textless{} \textgreater{}\textgreater{} \newline \newline //Logical \newline \&\& || ! \newline \newline //String Concatenation \newline +} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Structs}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{struct AuthorRecord \{ \newline public string name; \newline public float rank; \newline \newline public AuthorRecord(string name, float rank) \{ \newline this.name = name; \newline this.rank = rank; \newline \} \newline \} \newline \newline AuthorRecord author = new AuthorRecord("Steven", 8.8); \newline AuthorRecord author2 = author \newline \newline author.name = "Scott"; \newline SystemConsole.WriteLine(author.name); //Prints Steven \newline System.Console.WriteLine(author2.name); //Prints Scott} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Functions}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{// Pass by value (in, default), reference \newline //(in/out), and reference (out) \newline void TestFunc(int x, ref int y, out int z) \{ \newline x++; \newline y++; \newline z = 5; \newline \} \newline \newline int a = 1, b = 1, c; // c doesn't need initializing \newline TestFunc(a, ref b, out c); \newline System.Console.WriteLine("\{0\} \{1\} \{2\}", a, b, c); // 1 2 5 \newline \newline // Accept variable number of arguments \newline int Sum(params int{[}{]} nums) \{ \newline int sum = 0; \newline foreach (int i in nums) \newline sum += i; \newline return sum; \newline \} \newline \newline int total = Sum(4, 3, 2, 1); // returns 10 \newline \newline /{\emph{ C\# doesn't support optional arguments/parameters. \newline Just create two different versions of the same function. }}/ \newline void SayHello(string name, string prefix) \{ \newline \seqsplit{System.Console.WriteLine("Greetings}, " + prefix + " " + name); \newline \} \newline \newline void SayHello(string name) \{ \newline SayHello(name, ""); \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{File I/O}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{using System.IO; \newline \newline //Write out to text file \newline StreamWriter writer = File.CreateText \newline ("c:\textbackslash{}\textbackslash{}myfile.txt"); \newline writer.WriteLine("Out to file."); \newline writer.Close(); \newline \newline //Read all lines from text file \newline StreamReader reader = File.OpenText \newline ("c:\textbackslash{}\textbackslash{}myfile.txt"); \newline string line = reader.ReadLine(); \newline while (line != null) \{ \newline Console.WriteLine(line); \newline line = reader.ReadLine(); \newline \} \newline reader.Close(); \newline \newline //Write out to binary file \newline string str = "Text data"; \newline int num = 123; \newline BinaryWriter binWriter = new \seqsplit{BinaryWriter(File.OpenWrite} \newline ("c:\textbackslash{}\textbackslash{}myfile.dat")); \newline binWriter.Write(str); \newline binWriter.Write(num); \newline binWriter.Close(); \newline \newline //Read from binary file \newline BinaryReader binReader = new \seqsplit{BinaryReader(File.OpenRead} \newline ("c:\textbackslash{}\textbackslash{}myfile.dat")); \newline str = binReader.ReadString(); \newline num = binReader.ReadInt32(); \newline binReader.Close();} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Classes / Interfaces}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{//Accessibility keywords \newline public \newline private \newline internal \newline protected \newline protected internal \newline static \newline \newline \newline //Inheritance \newline class Articles: Authors \{ \newline ... \newline \} \newline \newline using System; \newline \newline interface IArticle\{ \newline void Show(); \newline \} \newline \newline \newline class IAuthor:IArticle\{ \newline public void Show() \{ \newline \seqsplit{System.Console.WriteLine("Show()} method Implemented"); \newline \} \newline \newline \newline public static void Main(string{[}{]} args) \{ \newline IAuthor author = new IAuthor(); \newline author.Show(); \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Arrays}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{int{[}{]} nums = \{1, 2, 3\}; \newline for (int i = 0; i \textless{} nums.Length; i++) \newline Console.WriteLine(nums{[}i{]}); \newline \newline \newline // 5 is the size of the array \newline string{[}{]} names = new string{[}5{]}; \newline names{[}0{]} = "Steven"; \newline // Throws \seqsplit{System.IndexOutOfRangeException} \newline names{[}5{]} = "Sarah" \newline \newline \newline // C\# can't dynamically resize an array. \newline //Just copy into new array. \newline string{[}{]} names2 = new string{[}7{]}; \newline // or names.CopyTo(names2, 0); \newline Array.Copy(names, names2, names.Length); \newline \newline float{[},{]} twoD = new float{[}rows, cols{]}; \newline twoD{[}2,0{]} = 4.5; \newline \newline int{[}{]}{[}{]} jagged = new int{[}3{]}{[}{]} \{ \newline new int{[}5{]}, new int{[}2{]}, new int{[}3{]} \}; \newline jagged{[}0{]}{[}4{]} = 5;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Data Types}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{//Value Types \newline bool \newline byte, sbyte \newline char (example: 'A') \newline short, ushort, int, uint, long, ulong \newline float, double \newline decimal \newline DateTime \newline \newline //Reference Types \newline object \newline string \newline \newline int x; \newline Console.WriteLine(x.GetType()) \newline Console.WriteLine(typeof(int)) \newline \newline //Type conversion \newline float d = 3.5; \newline int i = (int) d} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Constructors / Destructors}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{class TopAuthor \{ \newline private int \_topAuthor; \newline \newline public TopAuthor() \{ \newline \_topAuthor = 0; \newline \} \newline \newline public TopAuthor(int topAuthor) \{ \newline this.\_topAuthor= topAuthor \newline \} \newline \newline \textasciitilde{}TopAuthor() \{ \newline // Destructor code to free unmanaged resources. \newline // Implicitly creates a Finalize method \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Exception Handling}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{class Withfinally\{ \newline public static void Main() \{ \newline try \{ \newline int x = 5; \newline int y = 0; \newline int z = x/y; \newline Console.WriteLine(z); \newline \} \seqsplit{catch(DivideByZeroException} e) \{ \newline \seqsplit{System.Console.WriteLine("Error} occurred"); \newline \} finally \{ \newline \seqsplit{System.Console.WriteLine("Thank} you"); \newline \} \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Properties}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{private int \_size; \newline \newline public int Size \{ \newline get \{ \newline return \_size; \newline \} \newline set \{ \newline if (value \textless{} 0) \newline \_size = 0; \newline else \newline \_size = value; \newline \} \newline \} \newline \newline foo.Size++; \newline \newline using System; \newline class Date\{ \newline public int Day\{ \newline get \{ \newline return day; \newline \} \newline set \{ \newline day = value; \newline \} \newline \} \newline int day; \newline \newline \newline public int Month\{ \newline get \{ \newline return month; \newline \} \newline set \{ \newline month = value; \newline \} \newline \} \newline int month; \newline \newline \newline public int Year\{ \newline get \{ \newline return year; \newline \} \newline set \{ \newline year = value; \newline \} \newline \} \newline int year; \newline \newline \newline public bool IsLeapYear(int year) \{ \newline return year\%4== 0 ? true: false; \newline \} \newline public void SetDate (int day, int month, int year) \{ \newline this.day = day; \newline this.month = month; \newline this.year = year; \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Choices}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{greeting = age \textless{} 20 ? "What's up?" : "Hello"; \newline \newline if (x != 100 \&\& y \textless{} 5)\{ \newline // Multiple statements must be enclosed in \{\} \newline x {\emph{= 5; \newline y }}= 2; \newline \} \newline \newline if (x \textgreater{} 5) \newline x *= y; \newline else if (x == 5) \newline x += y; \newline else if (x \textless{} 10) \newline x -= y; \newline else \newline x /= y; \newline \newline //Must be integer or string \newline switch (color)\{ \newline case "black": \newline case "red": r++; \newline break; \newline case "blue" \newline break; \newline case "green": g++; \newline break; \newline default: other++; \newline break; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Constants}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{const int MAX\_AUTHORS = 25; \newline readonly float MIN\_RANKING = 5.00;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}