Category Archives: C#

C# – Formatting numeric strings

Formatting numeric strings is something that seems a developer would need to use now & again. You should know the alignment specifier; this indicates the minimum width of a field in terms of characters. Two key parts to it. An … Continue reading

Posted in C# | Leave a comment

C# – Static & Runtime type checking

C# programs are type checked both statically (at compile time) & runtime (by the CLR). Static checking enables the compiler to verify the correctness of your program without running it. This won’t work – because of static typing:     … Continue reading

Posted in C# | Leave a comment

C# – Multidimensional array (two types: rectangular & jagged)

Jagged arrays are arrays of arrays. Use a comma when defining a multidimensional array int[,] mdarray = new int[5,5]; Use GetLength method to get the length of one of the dimensions. mdarray.GetLength(0)

Posted in C# | Leave a comment

C# – Arrays

An array is a fixed number of elements of one type.     char[] vowels = new char[5]; // an array of 5 chars; elements 0-4 Once an array is created the length cannot be changed. Array initialization – allows … Continue reading

Posted in C# | Leave a comment