\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{Ziggiboy} \pdfinfo{ /Title (c.pdf) /Creator (Cheatography) /Author (Ziggiboy) /Subject (C\# 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}{0303A3} \definecolor{LightBackground}{HTML}{F7F7FC} \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{C\# Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Ziggiboy} via \textcolor{DarkBackground}{\uline{cheatography.com/184923/cs/38642/}}} \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}Ziggiboy \\ \uline{cheatography.com/ziggiboy} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 15th May, 2023.\\ Updated 16th May, 2023.\\ 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*}{2} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String methods}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Length}} & Returns the number of characters in a string. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{IndexOf}} & Finds the index of the first occurrence of a specified character or substring. \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} {\bf{Substring}} & Retrieves a portion of the string based on a specified index or length. \tn % Row Count 11 (+ 4) % Row 3 \SetRowColor{white} {\bf{ToUpper and ToLower}} & Converts a string to uppercase or lowercase, respectively \tn % Row Count 14 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{Trim}} & Removes leading and trailing whitespace characters from a string. \tn % Row Count 18 (+ 4) % Row 5 \SetRowColor{white} {\bf{Replace}} & Replaces all occurrences of a specified character or substring with another. \tn % Row Count 22 (+ 4) % Row 6 \SetRowColor{LightBackground} {\bf{Split}} & Splits a string into an array of substrings based on a specified delimiter. \tn % Row Count 26 (+ 4) % Row 7 \SetRowColor{white} {\bf{Concat}} & Concatenates multiple strings into a single string. \tn % Row Count 29 (+ 3) % Row 8 \SetRowColor{LightBackground} {\bf{Format}} & Formats a composite string by replacing placeholders with corresponding values. \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String methods (cont)}} \tn % Row 9 \SetRowColor{LightBackground} {\bf{Compare}} & Compares two strings and returns an integer indicating their relative order. \tn % Row Count 4 (+ 4) % Row 10 \SetRowColor{white} {\bf{Contains}} & Determines whether a specified character or substring exists within a string. \tn % Row Count 8 (+ 4) % Row 11 \SetRowColor{LightBackground} {\bf{StartsWith and EndsWith}} & Checks if a string starts or ends with a specified character or substring. \tn % Row Count 12 (+ 4) % Row 12 \SetRowColor{white} {\bf{PadLeft and PadRight}} & Adds padding characters to the left or right of a string to achieve a specified length. \tn % Row Count 17 (+ 5) % Row 13 \SetRowColor{LightBackground} {\bf{IsNullOrEmpty and IsNullOrWhiteSpace}} & Checks if a string is null, empty, or consists only of whitespace characters. \tn % Row Count 21 (+ 4) % Row 14 \SetRowColor{white} {\bf{Join}} & oncatenates an array of strings into a single string, using a specified delimiter. \tn % Row Count 26 (+ 5) % Row 15 \SetRowColor{LightBackground} {\bf{ToCharArray}} & Converts a string to an array of characters. \tn % Row Count 29 (+ 3) % Row 16 \SetRowColor{white} {\bf{CompareTo}} & Compares two strings and returns an integer indicating their relative order. \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String methods (cont)}} \tn % Row 17 \SetRowColor{LightBackground} {\bf{Substring (overload with start index and length)}} & Retrieves a substring from a string, starting at a specified index and with a specified length. \tn % Row Count 5 (+ 5) % Row 18 \SetRowColor{white} {\bf{Remove}} & Deletes a specified number of characters from a string, starting at a specified position. \tn % Row Count 10 (+ 5) % Row 19 \SetRowColor{LightBackground} {\bf{Equals}} & Compares two strings for equality, taking into account culture-specific or case-sensitive comparisons. \tn % Row Count 16 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Logical And Arithmetic Operators}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\&\&}} & AND \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{||}} & OR \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{+}} & Add \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\bf{-}} & Subtract \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{*}} & Multiply \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} {\bf{/}} & Divide \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} {\bf{\%}} & Modulo \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} {\bf{++}} & Increase 1 \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} {\bf{-{}-}} & Decrease 1 \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Arrays}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{string{[}{]} planets =}} \newline {\bf{ \{}} \newline {\bf{ "Mercury", "Venus", "Mars",}} \newline {\bf{ "Earth", "Jupiter", "Saturn", }} \newline {\bf{ "Uranus", "Neptune", "Pluto"}} \newline {\bf{ \};}} \newline \newline {\bf{ for (int i = 0; i \textless{} planets.Length; i++)}} \newline {\bf{ \{}} \newline {\bf{ Console.WriteLine(planets{[}i{]});}} \newline {\bf{ \}}} \newline \newline {\bf{ foreach (string planet in planets)}} \newline {\bf{ \{}} \newline {\bf{ Console.WriteLine(planet);}} \newline {\bf{ \}}} \newline \newline -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-- \newline \newline {\bf{array sort \& reverse:}} \newline {\bf{string{[}{]} names = \{ "Jane", "Frank", "Alice", "Tom" \};}} \newline \newline {\bf{ Array.Sort(names);}} \newline {\bf{ foreach (string name in names)}} \newline {\bf{ \{}} \newline {\bf{ Console.Write(name + " ");}} \newline {\bf{ \}}} \newline \newline {\bf{Array.Reverse(names);}} \newline {\bf{ foreach (string name in names)}} \newline {\bf{ \{}} \newline {\bf{ Console.Write(name + " ");}} \newline {\bf{ \}}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Switch case}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{switch(expression) \{}} \newline {\bf{ case constant-expression1 :}} \newline {\bf{ statement(s);}} \newline {\bf{ break;}} \newline {\bf{ case constant-expression2 :}} \newline {\bf{case constant-expression3 :}} \newline {\bf{ statement(s);}} \newline {\bf{ break;}} \newline \newline {\bf{ /{\emph{ you can have any number of case statements }}/}} \newline {\bf{default : /{\emph{ Optional }}/}} \newline {\bf{statement(s);}} \newline {\bf{\}}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{While loop}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{while(condition) }} \newline % Row Count 1 (+ 1) {\bf{\{}} \newline % Row Count 2 (+ 1) {\bf{ statement(s);}} \newline % Row Count 3 (+ 1) {\bf{\}}} \newline % Row Count 4 (+ 1) Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any non-zero value. The loop iterates while the condition is true. \newline % Row Count 8 (+ 4) When the condition becomes false, program control passes to the line immediately following the loop.% Row Count 10 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{do while loop}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{do }} \newline % Row Count 1 (+ 1) {\bf{\{}} \newline % Row Count 2 (+ 1) {\bf{ statement(s);}} \newline % Row Count 3 (+ 1) {\bf{\} while( condition );}} \newline % Row Count 4 (+ 1) Notice that the conditional expression appears at the end of the loop, so the statement(s) in the loop execute once before the condition is tested. \newline % Row Count 7 (+ 3) If the condition is true, the flow of control jumps back up to do, and the statement(s) in the loop execute again. This process repeats until the given condition becomes false.% Row Count 11 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Classes and objects}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{-{}-Classes-{}-}} \newline {\bf{class Car }} \newline {\bf{\{}} \newline {\bf{string color = "red";}} \newline {\bf{\}}} \newline \newline {\bf{-{}-Object-{}-}} \newline {\bf{class Car }} \newline {\bf{\{}} \newline {\bf{ string color = "red";}} \newline \newline {\bf{ static void Main(string{[}{]} args)}} \newline {\bf{ \{}} \newline {\bf{ Car myObj = new Car();}} \newline {\bf{ Console.WriteLine(myObj.color);}} \newline {\bf{ \}}} \newline {\bf{\}}} \newline \newline {\bf{-{}-Multiple Objects-{}-}} \newline {\bf{class Car}} \newline {\bf{\{}} \newline {\bf{ string color = "red";}} \newline {\bf{ static void Main(string{[}{]} args)}} \newline {\bf{ \{}} \newline {\bf{ Car myObj1 = new Car();}} \newline {\bf{ Car myObj2 = new Car();}} \newline {\bf{ Console.WriteLine(myObj1.color);}} \newline {\bf{ Console.WriteLine(myObj2.color);}} \newline {\bf{ \}}} \newline {\bf{\}}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.6 cm} x{6.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Comparison Operators}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\textless{}}} & Less than \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{\textgreater{}}} & Greater than \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{\textless{}=}} & Less than or equal to \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\bf{\textgreater{}=}} & Greater than or equal to \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{==}} & Equal to \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} {\bf{!=}} & Not equal to \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Comments}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{// Single line}} \newline % Row Count 1 (+ 1) {\bf{/* Multiple}} \newline % Row Count 2 (+ 1) {\bf{lines */}} \newline % Row Count 3 (+ 1) {\bf{/// XML comments on single line}}% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Assignment}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{=}} & Assignment \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{+=}} & Add \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{-=}} & Subtract \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Lists}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{List\textless{}int\textgreater{} number = new()}} \newline {\bf{ \{}} \newline {\bf{ 4, 6, 8, 1, 10, 2, 7, 3, 9, 5}} \newline {\bf{ \};}} \newline \newline {\bf{ number.Add(12);}} \newline {\bf{ number.Add(11);}} \newline {\bf{ number.Remove(1);}} \newline {\bf{ number.Sort();}} \newline \newline {\bf{foreach (int num in number)}} \newline {\bf{\{}} \newline {\bf{ Console.WriteLine(num);}} \newline {\bf{ \}}} \newline \newline {\bf{-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-}} \newline \newline {\bf{ List\textless{}string\textgreater{} word = new()}} \newline {\bf{ \{}} \newline {\bf{ "Delta", "Charlie", "Bravo", "Foxtrot", }} \newline {\bf{ "Echo", "Alpha", "Golf"}} \newline {\bf{ \};}} \newline \newline {\bf{ word.Add("India");}} \newline {\bf{ word.Add("Hotel");}} \newline {\bf{ word.Remove("Alpha");}} \newline {\bf{ word.Sort();}} \newline \newline {\bf{ foreach (string phonetic in word)}} \newline {\bf{ \{}} \newline {\bf{ Console.WriteLine(phonetic);}} \newline {\bf{ \}}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Casting}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Implicit Casting (automatically)}} & converting a smaller type to a larger type size char -\textgreater{} int -\textgreater{} long -\textgreater{} float -\textgreater{} double. \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} {\bf{Explicit Casting (manually)}} & converting a larger type to a smaller size type double -\textgreater{} float -\textgreater{} long -\textgreater{} int -\textgreater{} char. \tn % Row Count 10 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{Implicit Casting:}} \newline int myInt = 9; \newline double myDouble = myInt; // Automatic casting: int to double \newline \newline Console.WriteLine(myInt); // Outputs 9 \newline Console.WriteLine(myDouble); // Outputs 9 \newline \newline {\bf{Explicit Casting:}} \newline double myDouble = 9.78; \newline int myInt = (int) myDouble; // Manual casting: double to int \newline \newline Console.WriteLine(myDouble); // Outputs 9.78 \newline Console.WriteLine(myInt); // Outputs 9} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{for loop}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{for ( init; condition; increment ) }} \newline % Row Count 1 (+ 1) {\bf{\{}} \newline % Row Count 2 (+ 1) {\bf{ statement(s);}} \newline % Row Count 3 (+ 1) {\bf{\}}} \newline % Row Count 4 (+ 1) The init step is executed first, and only once. This step allows you to declare and initialize any loop control variables. You are not required to put a statement here, as long as a semicolon appears. \newline % Row Count 9 (+ 5) Next, the condition is evaluated. If it is true, the body of the loop is executed. If it is false, the body of the loop does not execute and flow of control jumps to the next statement just after the for loop. \newline % Row Count 14 (+ 5) After the body of the for loop executes, the flow of control jumps back up to the increment statement. This statement allows you to update any loop control variables. This statement can be left blank, as long as a semicolon appears after the condition. \newline % Row Count 20 (+ 6) The condition is now evaluated again. If it is true, the loop executes and the process repeats itself (body of loop, then increment step, and then again testing for a condition). After the condition becomes false, the for loop terminates.% Row Count 25 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.84 cm} x{6.16 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Data types}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{bool}} & Represents a Boolean value, either true or false. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{char}} & Represents a single Unicode character. \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{string}} & Represents a sequence of characters. \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{int}} & Represents signed integers (whole numbers) within the range -2,147,483,648 to 2,147,483,647. \tn % Row Count 10 (+ 4) % Row 4 \SetRowColor{LightBackground} {\bf{double}} & Represents double-precision floating-point numbers with decimal values. Sufficient for storing 15 decimal digits \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} {\bf{decimal}} & Represents decimal numbers with high precision and a larger range. \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} {\bf{float}} & Represents single-precision floating-point numbers with decimal values. Sufficient for storing 6 to 7 decimal digits \tn % Row Count 21 (+ 4) % Row 7 \SetRowColor{white} {\bf{long}} & Represents signed integers with a larger range than int, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. \tn % Row Count 25 (+ 4) % Row 8 \SetRowColor{LightBackground} {\bf{DateTime}} & Represents dates and times. \tn % Row Count 27 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Example method}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{namespace MyApplication}} \newline {\bf{\{}} \newline {\bf{ class Program}} \newline {\bf{ \{}} \newline {\bf{ static void Main(string{[}{]} args)}} \newline {\bf{ \{}} \newline {\bf{ MyMethod();}} \newline {\bf{ \}}} \newline \newline {\bf{ static void MyMethod()}} \newline {\bf{ \{}} \newline {\bf{ Console.WriteLine("I have a red banana");}} \newline {\bf{ \}}} \newline {\bf{ \}}} \newline {\bf{\}}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Ternary operator}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{condition ? consequent : alternative}} \newline % Row Count 1 (+ 1) {\bf{string GetWeatherDisplay(double tempInCelsius) =\textgreater{} tempInCelsius \textless{} 20.0 ? "Cold." : "Perfect!";}} \newline % Row Count 3 (+ 2) {\bf{Console.WriteLine(GetWeatherDisplay(15)); // output: Cold.}} \newline % Row Count 5 (+ 2) {\bf{Console.WriteLine(GetWeatherDisplay(27)); // output: Perfect!}}% Row Count 7 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}