.NET Array Dictionary List String 2D Async DataTable Dates DateTime Enum File For Foreach Format IEnumerable If IndexOf Lambda LINQ Parse Path Process Property Regex Replace Sort Split Static StringBuilder Substring Switch Tuple
Framework. A program does not exist alone. It relies on many other programs. In 2002 the .NET Framework was released. In our C# programs, we use keywords to access its types.
C# keywords. Some keywords (for, if and return) are reserved. This means they are used only in one way. And others (like using) have multiple meanings.
abstract as ascending async await base bool break byte case catch char checked class const continue decimal default delegate descending do double dynamic else enum equals event explicit extern false finally fixed float for foreach from get goto group if implicit in int interface internal is join let lock long namespace new null object operator orderby out override params private protected public readonly ref return sbyte sealed select set short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using value var virtual void volatile where while yield
Types. With keywords our code acts upon types. The language is a way to specify these types, combine them, test them. This list contains some of the most helpful types.
ArrayList Buffer Console DataRow DataSet DataTable DataView Dictionary Directory Environment Exception File FileInfo Hashtable IComparable IEnumerable KeyValuePair List Math Object Path Process Random Regex SqlClient SqlConnection SqlParameter Stopwatch StreamReader StreamWriter String StringBuilder Thread Timer TimeSpan Tuple XElement XmlReader XmlWriter
Directives. These can turn a program into an incomprehensible mess, a tangle of logic. But #define and #if and #region often have utility in complex programs.
Classes. Most things in C# involve objects. A string is an object. With a class, we create a type that when instantiated becomes an object.
Methods. In structured programming, we divide logical operations into separate methods. In the C# language, we use modifiers to specify method types.
Numbers. In computers, bits represent numbers at a low level. We can add, subtract, multiply and divide numbers. We can even shift their bits.
Interfaces. Programs tend to become complex. With an interface, we can invoke common functionality on many different classes. This keeps our code clearer.
Files. The types StreamReader and File are used to handle files. For special formats like HTML, additional types are available. Some methods are faster.
Intermediate language. This is a tedious page. It describes the IL that C# programs are transformed into. This is helpful for advanced developers.
Visual Studio. The C# language is a recognized standard. But Visual Studio makes this language easy to use. I offer some tips on VS.
ASP.NET. With this framework, we generate and send pages (or other data) to users on a network. ASP.NET has many capabilities. We use it with the C# language.
Windows Forms. This is a framework for the creation of Windows user interfaces. We can run these programs on nearly any Windows operating system, like Windows 8.
WPF, Windows Presentation Foundation, is an advanced user interface toolkit. It works as a replacement for Windows Forms. We control programs with C# code.
Console. Many programs can be written as console programs. These do not provide elaborate interfaces to the user. There is no need to bother with interface widgets.
Threads. A C# program by default is single-threaded. With System.Threading, we add threads. We start and join them. This adds complexity.
Drawing. Shapes and colors do not come out of thin air. Instead we use the System.Drawing namespace to create them in code. This provides no advanced effects.
Reflection. Metadata is a relational database. It contains many types. With reflection a program can inspect and act upon them. The syntax here is confusing.
Compression. The .NET Framework supports compression algorithms, like GZIP, in the System.IO.Compression namespace. We can use GZipStream to handle compressed byte arrays.
System. Many of the most common types in the .NET Framework are located in the System namespace. Most C# files include the System namespace at the top.
Memory. The .NET Framework provides a garbage-collected heap. But this does not erase the benefits of observing and optimizing memory usage.
Memory of types: We measure decimal types, nullable types, strings and reference and value types in general.
Memory of arrays: How much memory do arrays use? I attempt to answer this question with benchmarks.
Dispose. The using statement ensures memory is released as soon as possible. It invokes the Dispose method in the underlying implementation.
Network. We access networking functionality in System.Net. The classes include System.Dns, which resolves DNS addresses. We also access the System.WebClient class, which downloads files.
Performance. I think performance is important. The developers behind the .NET Framework think so too. Microsoft's teams are careful to maintain good performance.
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 for testing .NET programs.
Compiler: The C# compiler is a work of art. It outputs correct and fast IL code. It reports errors.
Utilities: Even a great developer sometimes needs some help. Tools like FxCop can catch troublesome problems.
Concepts. Let us consider the big picture. Software performance is largely determined by how different levels in the memory hierarchy vary in access times.
Syntax hints. A question mark can mean a ternary statement, or a nullable type. A period can mean a member access or a floating-point number. Here are some syntax hints.
Many parts. The .NET Framework has many parts. It includes the infrastructure upon which C# and VB.NET can be written and compiled. It also provides the runtime.