28 November 2018

c#basics Arrays, code snippets

Introduction to Arrays: array is a storage for many elements in a same collection. i.e. list of 100 grades for a class
Array types:
– single dimension []
matrix[,]
jagged[][]

Initialize an array: i.e. array of 10 integers:
int[] grades = new int[10];

Get the array length: grades.length

for loop on the array:
for(int i = 0; i < grades.length; i++) { … }

Code Snippets:
Code snippets are used to paste code into the visual studio with a keyboard shortcut. i.e. “cw” + tab + tab write Console.WriteLine()
So, we can make our on shortcuts. In class we made an example of making a keyboard shortcut “ccr” which pastes:
Convert.ToInt32(Console.ReadLine());
see the video…

Leave a comment

Design a site like this with WordPress.com
Get started