.NET Array Collections File String Async Cast DataTable DateTime Dictionary Enum Exception For Foreach IEnumerable If IndexOf Lambda LINQ List Parse Path Process Property Regex Replace Sort Split 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.abstractasascendingasyncawaitbaseboolbreakbytecasecatchcharcheckedclassconstcontinuedecimaldefaultdelegatedescendingdodoubledynamicelseenumequalseventexplicitexternfalsefinallyfixedfloatforforeachfromgetgotogroupifimplicitinintinterfaceinternalisjoinletlocklongnamespacenewnullobjectoperatororderbyoutoverrideparamsprivateprotectedpublicreadonlyrefreturnsbytesealedselectsetshortsizeofstackallocstaticstringstructswitchthisthrowtruetrytypeofuintulonguncheckedunsafeushortusingvaluevarvirtualvoidvolatilewherewhileyield
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.ArrayListBufferConsoleDataRowDataSetDataTableDataViewDictionaryDirectoryEnvironmentFileFileInfoHashtableIComparableIEnumerableKeyValuePairListMathObjectPathProcessRandomRegexSqlClientSqlConnectionSqlParameterStopwatchStreamReaderStreamWriterStringStringBuilderThreadTimerTimeSpanTupleXElementXmlReaderXmlWriter
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.Directives
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.ClassClass: ConstructorClass: Attribute
Methods. In structured programming, we divide logical operations into separate methods. In the C# language, we use modifiers to specify method types.Methods
Numbers. In computers, bits represent numbers at a low level.
We can add,
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.Interface
Files. The types StreamReader and File are used to handle files. For special formats like HTML, additional types are available. Some methods are faster.FilesFiles: HTML
Intermediate language. This is a tedious page. It describes the IL that C# programs are transformed into. This is helpful for advanced developers.IL
Visual Studio. The C# language is a recognized standard. But Visual Studio makes this language easy to use. I offer some tips on VS.Visual StudioDebug
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.ASP.NET
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.Windows Forms
WPF, Windows Presentation Foundation, is an advanced user interface toolkit. It works as a replacement for Windows Forms. We control programs with C# code.WPF
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.Console
Threads. A C# program by default is single-threaded. With System.Threading, we add threads. We start and join them. This adds complexity.Threads
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.Drawing
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.Reflection
Compression. The .NET Framework supports compression algorithms, like GZIP, in the System.IO.Compression namespace. We can use GZipStream to handle compressed byte arrays.Compression
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.Using System
Memory. The .NET Framework provides a garbage-collected heap. But this does not erase the benefits of observing and optimizing memory usage.GC.CollectWeakReference
Memory of types:We measure decimal types, nullable types, strings and reference and value types in general.Memory: DecimalMemory: NullableMemory: String
Memory of arrays:How much memory do arrays use? I attempt to answer this question with benchmarks.Array MemoryArray Memory: OptimizationArray Memory: Bools
Dispose. The using statement ensures memory is released as soon as possible. It invokes the Dispose method in the underlying implementation.Using
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.DnsWebClientHttpClient
Performance. I think performance is important. The developers behind the .NET Framework think so too. Microsoft's teams are careful to maintain good performance.Performance BenchmarkProfileOptimization
Tools. As developers, we build upon the works of many others.
Every program involves,
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.Compiler
Utilities:Even a great developer sometimes needs some help. Tools like FxCop can catch troublesome problems.FxCopIL DisassemblerProcess Explorer
Concepts. Let us consider the big picture. Software performance is largely determined by how different levels in the memory hierarchy vary in access times.Memory Hierarchy
Locality. In our universe the speed of light is constant. So things nearer together (with greater locality) are faster to access. This applies in software.Temporal LocalityLocality of Reference
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.