Collections.` Through the grey mist an ancient ship appears. It carries cargo of the rarest sort. It has gold coins, diamonds and rubies. The air cools and it begins to rain.`This page` has links to collections. A list of links has its place. But to find things, it is usually easier to search. There are so many treasures, they are hard to find.`Classes.` A class is a template. Instances of a class are instances of that template. So many things can be created with classes. Here are some top classes. `Buffer `buffer`Console `console`DataRow `datarow`DataSet `dataset`DataTable `datatable`DataView `dataview`Debug `debug-write`Directory `directory`Environment `environment`Exception `exception`File `file`FileInfo `fileinfo`HttpClient `httpclient`IComparable `icomparable`IEnumerable `ienumerable`IEqualityComparer `iequalitycomparer`Object `object`Path `path`Process `process`Random `random`Regex `regex`SqlClient `sqlclient`SqlConnection `sqlconnection`SqlParameter `sqlparameter`Stopwatch `stopwatch`StreamReader `streamreader`StreamWriter `streamwriter`String `string`StringBuilder `stringbuilder`StringReader `stringreader`StringWriter `stringwriter`System `system`Task `async`Thread `thread`Timer `timer`TimeSpan `timespan`Type `type`XElement `xelement`XmlReader `xmlreader`XmlWriter `xmlwriter`Collections.` Think of a treasure chest. In it we find many gold coins (if we are lucky). The chest is a collection of another kind of thing—it is a container. `ArrayList `arraylist`BitArray `bitarray`ConcurrentBag `concurrentbag`ConcurrentDictionary `concurrentdictionary`ConcurrentQueue `concurrentqueue`ConcurrentStack `concurrentqueue`Dictionary `dictionary`DictionaryEntry `dictionaryentry`HashSet `hashset`Hashtable `hashtable`HybridDictionary `hybriddictionary`KeyValuePair `keyvaluepair`Lazy `lazy`LinkedList `linkedlist`List `list`ListDictionary `listdictionary`NameValueCollection `namevaluecollection`Queue `queue`ReadOnlyCollection `readonlycollection`SortedDictionary `sorteddictionary`SortedList `sortedlist`SortedSet `sortedset`Stack `stack`StringDictionary `stringdictionary`Tuple `tuple`Classes, concepts.` Most things in C# involve objects. A string is an object. With a class, we create a type that when instantiated becomes an object. `Class `class`Class: Constructor `constructor`Class: Inheritance `inheritance`Class: Nested `nested-class`Class: Variable Initializer `variable-initializer`Classes, convert.` It is fine to use an array or a list. But when we need to convert to a dictionary of int lists, we have a small problem. We must convert our data. `Convert `cast`Convert: Array, String `convert-char-array-string`Convert: ArrayList, Array `convert-arraylist-array`Convert: ArrayList, List `convert-arraylist-list`Convert: Bool, Int `convert-bool-int`Convert: Char, String `convert-char-string`Convert: Dictionary, List `convert-dictionary-list`Convert: Dictionary, String `convert-dictionary-string`Convert: List, Array `convert-list-array`Convert: List, DataTable `convert-list-datatable`Convert: List, String `convert-list-string`Convert: String, Byte Array `convert-string-byte-array`Convert: String Array, String `convert-string-array-string`Convert: TimeSpan, Long `convert-timespan-long`Convert: Value, Int `cast-int`Attributes.` With an attribute we attach information to a C# type. This can be used by another program (like the C# compiler) to affect how code is processed. `Attribute `attribute`[Conditional] `conditional`[DllImport] `dllimport`[Flags] `enum-flags`[Obsolete] `obsolete`Generics.` Many of the most powerful (and fastest) collections are found in System.Collections.Generic. These are generic types. The syntax is strange yet powerful. `Generic: Classes `generic`Generic: Methods `generic-method`Design patterns.` Imagine a factory. It makes widgets or shoes or something. We just expect the finished product from the factory—it does the rest. `Pattern: Factory `factory`Pattern: Protection Proxy `protection-proxy`Pattern: Tester-Doer `tester-doer`Directives.` These can turn a program into a nasty, smelly mess. But #define and #if and #region often have utility in complex programs. `#define, #undef `define-undef`#error `error`#if, #elif, #endif `if-elif-endif`#line `line`#pragma `pragma`#region `region`Methods, numeric.` With methods we express algorithms. It helps to get started by implementing a Fibonacci method. This can be done in many ways. `Method: Compound Interest `compound-interest`Method: Fibonacci `fibonacci`Method: Swap `swap`Methods, strings.` Some methods act on strings. For example the Levenshtein Distance algorithm computes how similar two strings are. `String: Boyer-Moore `boyer-moore`String: Count Occurrences `string-occurrence`String: Duplicate Words `duplicate-words`String: Explode `explode`String: Levenshtein `levenshtein`Methods, puzzles.` A computer can try to solve any puzzle. I tried to solve the Mu puzzle and no amount of optimizations could make it happen. `Puzzle: Anagram `anagram`Puzzle: Constraint Solver `constraint`Puzzle: Monty Hall `monty-hall-problem`Puzzle: Mu `mu`Puzzle: Palindrome `palindrome`Methods, parameters.` A method can accept any number of parameters. With overloads, we can have a method with the same name that acts differently based on its arguments. `Parameters `parameter`Parameters: Multiple Return Values `multiple-return-values`Parameters: Named `named-parameters`Parameters: Optional `optional-parameters`Parameters: Overloading `overload`Methods, algorithms.` With recursion we can evaluate all possibilities. For some puzzles, we can exhaustively search the problem space. `Algorithm: Count Change `change`Algorithm: Inverted Index `inverted-index`Algorithm: Maze `maze`Algorithm: Recursion `recursion`Algorithm: Spell Check `spell-checker`Algorithm: Tree `tree`Algorithm: Word Search `word-search`Methods, locals.` With variables we specify what a method does. Locals change state. They introduce complexity because the program's state depends on time. `Locals: Benchmark `assign`Locals: Definite Assignment `definite-assignment-analysis`Locals: Max Allowed `locals-allowed`Locals: Multiple Declarations `multiple-local-variable`Methods, ciphers.` In a cipher we obscure the characters in text. Simple ciphers like ROT13 can be broken easily. But they are still interesting. `Cipher: Atbash `atbash`Cipher: Caesar `caesar`Cipher: ROT13 `rot13`Intermediate language.` This is a tedious page. It describes the IL that C# programs are transformed into. This is helpful for advanced developers. `IL `il`Threads.` A C# program by default is single-threaded. With System.Threading, we add threads. We start and join them. This adds complexity. `Thread `thread`Thread: Interlocked `interlocked`Thread: Join `thread-join`Thread: Mutex `mutex`Thread: Sleep `sleep`Thread: SpinWait `spinwait`Thread: Start `threadstart`Thread: ThreadPool `threadpool`Reflection.` Metadata is a relational database. It contains many types. With reflection our program can inspect and act upon them. `Reflection `reflection`Reflection: Assembly `assembly`Reflection: GetType `gettype`Drawing.` The tools in System.Drawing are not powerful. We cannot create a great painting. But we can draw shapes and colors and text. `Drawing: Color `color`Drawing: Font `font`Drawing: GetThumbnailImage `getthumbnailimage`Drawing: Image `image`Drawing: Point `point`Drawing: Size `size`Compression.` The .NET Framework supports compression algorithms, like GZIP, in the System.IO.Compression namespace. GZipStream handles byte arrays. `Compression: 7-Zip Command Line `7-zip-examples`Compression: CompressionLevel `compressionlevel`Compression: GZipStream `gzipstream`Compression: GZipStream Compress `compress`Compression: GZipStream Decompress `decompress`Compression: GZIP Files and Bytes `gzip`Compression: ZipFile `zipfile`Memory.` The .NET Framework provides a garbage-collected heap. But there are still observable benefits of optimizing memory usage. `GC: Collect `gc-collect`GC: WeakReference `weakreference`Object.` Consider a type hierarchy. Each type inherits from another type. At the top of the tree in the .NET Framework we find the Object type. `Object `object`Object: Clone `clone`Object: ReferenceEquals `object-referenceequals`Object: Unboxing `unboxing`Network.` We access networking functionality in System.Net. The classes include System.Dns, which resolves DNS addresses. We also access the System.WebClient class. `Net: DNS `dns`Net: HttpClient `httpclient`Net: WebClient `webclient`Tools.` As developers, we build upon the works of many others. Every program involves, indirectly, many millions of lines of code. Many tools are useful. `Tools: IL Disassembler `il-disassembler`Tools: Visual Studio `visual-studio`Tools: Visual Studio Debugger `debugging`Numbers.` We can add, subtract, multiply and divide numbers. In C# we increment and decrement a number even in simple loops. We can cast numbers. `Numbers: BigInteger `biginteger`Numbers: BitConverter `bitconverter`Numbers: Cast `numeric-casts`Numbers: Count Digits `integer-digit-count`Numbers: Divide `divide`Numbers: English Words `number-words`Numbers: Increment `increment`Numbers: int.MaxValue `int-maxvalue`Numbers: Int16, 32, 64 `int16-int32-int64`Numbers: Multiply `multiply`Numbers: Numeric Promotion `numeric-promotion`Numbers: Odd `odd`Numbers: Percentage `percentage`Numbers: Prime `prime`Numbers: Reciprocal `reciprocal`Numbers: Single, Double `single-double`Numbers: Suffix `suffix`Numbers, bits.` In computers, bits represent numbers at a low level. We can use a single bit to mean yes or no. We can apply masks to bit patterns. `Bits: And `and`Bits: BitVector32 `bitvector32`Bits: Complement `complement`Bits: Count `bitcount`Bits: Divide, Powers of Two `divide-powers-two`Bits: Increment `integer-increment-binary`Bits: Or `or`Bits: Representation `binary-representation`Bits: Set Bit to Zero `set-bit-zero`Bits: Shift `shift`Bits: Trailing `trailing-bits`Bits: XOR `xor`Number, convert.` It is not possible to convert 1 day into 1 month. That makes no sense. But we can convert 1 day into a fractional month—we just change the units. `Convert: Bytes, Megabytes `convert-bytes-megabytes`Convert: Celsius, Fahrenheit `convert-degrees`Convert: Days, Months `convert-days-months`Convert: Feet, Inches `feet-inches`Convert: Miles, Kilometers `convert-miles-kilometers`Convert: Milliseconds, Seconds `convert-milliseconds`Convert: Nanoseconds, Seconds `convert-nanoseconds`Math.` Rarely do we need to implement mathematical methods. Instead we use built-in methods from the Math class. Things like Math.Max can help with loop bounds. `Math `math`Math.Abs `math-abs`Math.Ceiling `math-ceiling`Math.Cos, Sin, Tan `cos-sin-tan`Math.E `math-e`Math.Floor `math-floor`Math.Log, Log10 `log`Math.Max `math-max`Math.Min `math-min`Math.PI `pi`Math.Pow `math-pow`Math.Round `math-round`Math.Sqrt `sqrt`Math.Truncate `math-truncate`Exception types.` Suddenly your program has failed. It tells you it has an exception. But this can be fixed with some attention—here are common exceptions. `ArgumentException `argumentexception`ArrayTypeMismatchException `arraytypemismatchexception`DirectoryNotFoundException `ioexception`DivideByZeroException `dividebyzeroexception`FileNotFoundException `filenotfoundexception`FormatException `format`IndexOutOfRangeException `indexoutofrangeexception`InsufficientMemoryException `memoryfailpoint`InvalidCastException `invalidcastexception`InvalidOperationException `invalidoperationexception`IOException `ioexception`KeyNotFoundException `keynotfoundexception`NotImplementedException `notimplementedexception`NullReferenceException `nullreferenceexception`OutOfMemoryException `outofmemoryexception`OverflowException `overflowexception`StackOverflowException `stackoverflowexception`TypeInitializationException `typeinitializationexception`Many parts.` The .NET Framework has many parts. It has collections, classes, keywords and all sorts of syntax. The universe is vast. But a .NET developer like you is sure to succeed.