\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{Calment (Calment)} \pdfinfo{ /Title (visual-c-2008-branch-loop-array.pdf) /Creator (Cheatography) /Author (Calment (Calment)) /Subject (Visual C\# 2008 - Branch, Loop, Array 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}{4169E1} \definecolor{LightBackground}{HTML}{F3F5FD} \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{Visual C\# 2008 - Branch, Loop, Array Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Calment (Calment)} via \textcolor{DarkBackground}{\uline{cheatography.com/121924/cs/22533/}}} \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}Calment (Calment) \\ \uline{cheatography.com/calment} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 24th April, 2020.\\ 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*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{if}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{if (Condition1) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   Enter the loop processing; \newline % Row Count 3 (+ 1) \} \newline % Row Count 4 (+ 1) else if (Condition2) \newline % Row Count 5 (+ 1) \{ \newline % Row Count 6 (+ 1)   Enter the loop processing; \newline % Row Count 7 (+ 1) \} \newline % Row Count 8 (+ 1) else \newline % Row Count 9 (+ 1) \{ \newline % Row Count 10 (+ 1)   if (Condition3) \newline % Row Count 11 (+ 1)   \{ \newline % Row Count 12 (+ 1)     Enter the loop processing; \newline % Row Count 13 (+ 1)   \} \newline % Row Count 14 (+ 1) \}% Row Count 15 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{switch}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{switch (Formula) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   case Condition1: \newline % Row Count 3 (+ 1)     Enter the loop processing; \newline % Row Count 4 (+ 1)     break; \newline % Row Count 5 (+ 1)   case Condition2: \newline % Row Count 6 (+ 1)     Enter the loop processing; \newline % Row Count 7 (+ 1)     break; \newline % Row Count 8 (+ 1)   default: \newline % Row Count 9 (+ 1)     Enter the loop processing; \newline % Row Count 10 (+ 1)     break; \newline % Row Count 11 (+ 1) \}% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{for}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{for (Variable; LoopCondition; Processing) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   Enter the loop processing; \newline % Row Count 3 (+ 1) \}% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\seqsplit{・~・~・~・~・~・~・~・}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{foreach}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{foreach (DataType Variable in Collction) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   Enter the loop processing; \newline % Row Count 3 (+ 1) \}% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{while}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{while (LoopCondition) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   Enter the loop processing; \newline % Row Count 3 (+ 1) \}% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{do-while}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{do \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   Enter the loop processing; \newline % Row Count 3 (+ 1) \} \newline % Row Count 4 (+ 1) while (LoopCondition);% Row Count 5 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{break}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{1. Break the loop midway.} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{2. Use break when nesting.} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{continue}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{1. Skip processing in loop.} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{2. Use continue when nesting.} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\seqsplit{・~・~・~・~・~・~・~・}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Example}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Example of use.} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{if - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int iNum = 5; \newline % Row Count 1 (+ 1) if (iNum == 0) \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1) \seqsplit{  Console.WriteLine("0");} \newline % Row Count 4 (+ 1) \} \newline % Row Count 5 (+ 1) else if (iNum == 1) \newline % Row Count 6 (+ 1) \{ \newline % Row Count 7 (+ 1) \seqsplit{  Console.WriteLine("1");} \newline % Row Count 8 (+ 1) \} \newline % Row Count 9 (+ 1) else \newline % Row Count 10 (+ 1) \{ \newline % Row Count 11 (+ 1)   if (iNum \textless{} 10) \newline % Row Count 12 (+ 1)   \{ \newline % Row Count 13 (+ 1) \seqsplit{    Console.WriteLine(iNum);} \newline % Row Count 14 (+ 1)   \} \newline % Row Count 15 (+ 1) \}% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : 5} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{switch - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int iColor= 2; \newline % Row Count 1 (+ 1) switch (iColor) \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1)   case "1": \newline % Row Count 4 (+ 1) \seqsplit{    Console.WriteLine("White");} \newline % Row Count 5 (+ 1)     break; \newline % Row Count 6 (+ 1)   case "2": \newline % Row Count 7 (+ 1) \seqsplit{    Console.WriteLine("Blue");} \newline % Row Count 8 (+ 1)     break; \newline % Row Count 9 (+ 1)   default: \newline % Row Count 10 (+ 1) \seqsplit{    Console.WriteLine("Black");} \newline % Row Count 11 (+ 1)     break; \newline % Row Count 12 (+ 1) \}% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : Blue} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\seqsplit{・~・~・~・~・~・~・~・}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{for - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{for (int iNum = 0; iNum \textless{} 3; iNum++) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1) \seqsplit{  Console.Write(iNum);} \newline % Row Count 3 (+ 1) \}% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : 123} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{foreach - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{var color = new{[}{]} \{ "White", "Blue", "Black" \}; \newline % Row Count 1 (+ 1) foreach (string strColor in color) \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1) \seqsplit{  Console.Write(strColor);} \newline % Row Count 4 (+ 1) \}% Row Count 5 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : WhiteBlueBlack} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{while - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int i = 0; \newline % Row Count 1 (+ 1) while (i \textless{} 5) \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1)   Console.Write(i + ","); \newline % Row Count 4 (+ 1)   i++; \newline % Row Count 5 (+ 1) \}% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : 0,1,2,3,4,} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{break - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{for (int i = 0; i \textless{} 2; i++) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   for (int j = 0; j \textless{} 2; j++) \newline % Row Count 3 (+ 1)   \{ \newline % Row Count 4 (+ 1)     if (j == 0) \newline % Row Count 5 (+ 1)     \{ \newline % Row Count 6 (+ 1)       break; \newline % Row Count 7 (+ 1)     \} \newline % Row Count 8 (+ 1) \seqsplit{    Console.WriteLine("j} =" + j); \newline % Row Count 10 (+ 2)   \} \newline % Row Count 11 (+ 1) \seqsplit{  Console.WriteLine("i} =" + i); \newline % Row Count 12 (+ 1) \}% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Only the inner for statement is removed.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{do-while - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int i = 0; \newline % Row Count 1 (+ 1) do \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1)   Console.Write(i + ","); \newline % Row Count 4 (+ 1)   i++; \newline % Row Count 5 (+ 1) \} \newline % Row Count 6 (+ 1) while (i \textless{} 5);% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : 0,1,2,3,4,} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{break - example - do-while}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int i = 0; \newline % Row Count 1 (+ 1) do \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1)   if (i == 3) \newline % Row Count 4 (+ 1)   \{ \newline % Row Count 5 (+ 1)     break; \newline % Row Count 6 (+ 1)   \} \newline % Row Count 7 (+ 1)   Console.Write(i + ","); \newline % Row Count 8 (+ 1)   i++; \newline % Row Count 9 (+ 1) \} \newline % Row Count 10 (+ 1) while (true);% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{The condition is true. \newline Warning: Without break, it becomes an infinite loop.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{continue - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{for (int i = 0; i \textless{} 2; i++) \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   for (int j = 0; j \textless{} 2; j++) \newline % Row Count 3 (+ 1)   \{ \newline % Row Count 4 (+ 1)     if (j == 0) \newline % Row Count 5 (+ 1)     \{ \newline % Row Count 6 (+ 1) \seqsplit{      continue;} \newline % Row Count 7 (+ 1)     \} \newline % Row Count 8 (+ 1) \seqsplit{    Console.WriteLine("j} =" + j); \newline % Row Count 9 (+ 1)   \} \newline % Row Count 10 (+ 1) \seqsplit{  Console.WriteLine("i} =" + i); \newline % Row Count 11 (+ 1) \}% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Return to the declaration line of the inner for statement.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{continue - example - while}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int i = 0; \newline % Row Count 1 (+ 1) while (i \textless{} 5) \newline % Row Count 2 (+ 1) \{ \newline % Row Count 3 (+ 1)   if (i == 3) \newline % Row Count 4 (+ 1)   \{ \newline % Row Count 5 (+ 1)     continue; \newline % Row Count 6 (+ 1)   \} \newline % Row Count 7 (+ 1)   Console.Write(i + ","); \newline % Row Count 8 (+ 1)   i++; \newline % Row Count 9 (+ 1) \}% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Next run line 2.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Array}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{DataType{[}{]} VariableName \newline % Row Count 1 (+ 1)      = New DataType{[}ElementNumber{]};% Row Count 2 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{1.VariableName{[}Index{]}. \newline 2.Index starts from 0.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Array - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{string{[}{]} srtColors1 = new string{[}{]} \{ \newline % Row Count 1 (+ 1)     "White", "Snow", "GhostWhite"\}; \newline % Row Count 2 (+ 1) Console.Write(srtColors1{[}0{]} + ","); \newline % Row Count 3 (+ 1) Console.Write(srtColors1{[}1{]} + ","); \newline % Row Count 4 (+ 1) Console.WriteLine(srtColors1{[}2{]}); \newline % Row Count 5 (+ 1) var srtColors2 = new string{[}{]} \{ \newline % Row Count 6 (+ 1) \seqsplit{    "LightSkyBlue"}, "Blue", "Navy"\}; \newline % Row Count 7 (+ 1) Console.Write(srtColors2{[}0{]} + ","); \newline % Row Count 8 (+ 1) Console.Write(srtColors2{[}1{]} + ","); \newline % Row Count 9 (+ 1) Console.WriteLine(srtColors2{[}2{]}); \newline % Row Count 10 (+ 1) var srtColors3 = new{[}{]} \{ \newline % Row Count 11 (+ 1)     "WhiteSmoke", "Silver", "Black"\}; \newline % Row Count 12 (+ 1) Console.Write(srtColors3{[}0{]} + ","); \newline % Row Count 13 (+ 1) Console.Write(srtColors3{[}1{]} + ","); \newline % Row Count 14 (+ 1) Console.WriteLine(srtColors3{[}2{]});% Row Count 15 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : White,Snow,GhostWhite \newline Result : LightSkyBlue,Blue,Navy \newline Result : WhiteSmoke,Silver,Black} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Array - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{string{[}{]} srtColors = new string{[}3{]}; \newline % Row Count 1 (+ 1) srtColors{[}0{]} = "Snow"; \newline % Row Count 2 (+ 1) srtColors{[}1{]} = "Navy"; \newline % Row Count 3 (+ 1) srtColors{[}2{]} = "Silver"; \newline % Row Count 4 (+ 1) Console.Write(srtColors{[}0{]} + ","); \newline % Row Count 5 (+ 1) Console.Write(srtColors{[}1{]} + ","); \newline % Row Count 6 (+ 1) Console.WriteLine(srtColors{[}2{]});% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : Snow,Navy,Silver} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Array - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{string{[}{]} srtColors = new string{[}{]} \{ \newline % Row Count 1 (+ 1)     "White", "Snow", "GhostWhite"\}; \newline % Row Count 2 (+ 1) Array.Resize(ref srtColors , 4); \newline % Row Count 3 (+ 1) srtColors{[}3{]} = "WhiteSmoke"; \newline % Row Count 4 (+ 1) foreach (string srtColor in srtColors) \newline % Row Count 5 (+ 1) \{ \newline % Row Count 6 (+ 1) \seqsplit{  Console.WriteLine(srtColor);} \newline % Row Count 7 (+ 1) \}% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : White \newline     Snow \newline     GhostWhite \newline     WhiteSmoke} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Array - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{static void Main() \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   string{[}{]} srtColors = new string{[}3{]} \{ \newline % Row Count 3 (+ 1) \seqsplit{       "LightSkyBlue"}, "Blue", "Navy"\}; \newline % Row Count 5 (+ 2)   string{[}{]} b = GetColor(srtColors); \newline % Row Count 6 (+ 1) \} \newline % Row Count 7 (+ 1) private static string{[}{]} GetColor(string{[}{]} strColor) \newline % Row Count 9 (+ 2) \{ \newline % Row Count 10 (+ 1)   return strColor; \newline % Row Count 11 (+ 1) \}% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Array - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{static void Main() \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   string{[}{]} srtBule = new string{[}{]} \{ \newline % Row Count 3 (+ 1) \seqsplit{         "LightSkyBlue"}, "Blue", "Navy"\}; \newline % Row Count 5 (+ 2)   List\textless{}string\textgreater{} ColorList \newline % Row Count 6 (+ 1) \seqsplit{         =} new List\textless{}string\textgreater{}(srtBule); \newline % Row Count 8 (+ 2) \seqsplit{  ColorList.Add("RoyalBlue");} \newline % Row Count 9 (+ 1)   foreach (string sColor in ColorList) \newline % Row Count 10 (+ 1)   \{ \newline % Row Count 11 (+ 1) \seqsplit{    Console.WriteLine(sColor);} \newline % Row Count 12 (+ 1)   \} \newline % Row Count 13 (+ 1) \}% Row Count 14 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : LightSkyBlue \newline     Blue \newline     Navy \newline     RoyalBlue} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{2D Array - example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{string{[},{]} colors = new string{[}2,3{]} \newline % Row Count 1 (+ 1) \{ \newline % Row Count 2 (+ 1)   \{"LightSkyBlue", "Blue", "Navy"\}, \newline % Row Count 3 (+ 1)   \{"WhiteSmoke", "Silver", "Black"\} \newline % Row Count 4 (+ 1) \}; \newline % Row Count 5 (+ 1) Console.Write(colors{[}0, 0{]}+ ","); \newline % Row Count 6 (+ 1) Console.Write(colors{[}0, 1{]}+ ","); \newline % Row Count 7 (+ 1) Console.WriteLine(colors{[}0, 2{]}); \newline % Row Count 8 (+ 1) Console.Write(colors{[}1, 0{]}+ ","); \newline % Row Count 9 (+ 1) Console.Write(colors{[}1, 1{]}+ ","); \newline % Row Count 10 (+ 1) Console.WriteLine(colors{[}1, 2{]});% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Result : LightSkyBlue,Blue,Navy \newline     WhiteSmoke,Silver,Black} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}