C# Tutorials - Herong's Tutorial Examples

https://www.herongyang.com/C-Sharp

Copyright © 2006-2022 Herong Yang. All rights reserved.

C# Tutorials This book is a collection of notes and sample codes written by the author while he was learning C#. Topics include: Data, Variables and Expressions; Logical Expressions and Conditional Statements; Arrays and Loops; Data Types; Precision of 'float', 'double', and 'decimal'; Performance of 'float', 'double', and 'decimal'; Binary Representation of 'float' and 'double' Values; Binary Representation of 'decimal' Values - Methods; Execution Environment; Common Language Runtime; Intermediate Language Assembler and Disassembler; Private Memory vs. Virtual Memory; Multithreading programs; Async and Await Feature; WPF (Windows Presentation Foundation); MSBuild tool; XAML (eXtensible Application Markup Language). Updated in 2022 (Version v3.32) with minor changes.

Table of Contents

About This Book

Introduction of C# (C Sharp)

What Is C#?

Installing .NET Framework 4.6.1 SDK

First Program in C#

C# Program Structure

Data Type and Variables

Data Literals

Data Literals - Example

Variables and Assignment Statements

Variables and Assignments - Example

Arithmetic Operations

Arithmetic Operations - Example

Logical Expressions and Conditional Statements

Logical Expressions

"if" Statements

"if" Statements - Example

"switch" Statements

"switch" Statements - Example

Arrays and Loop Statements

Creating and Using Arrays

Creating and Using Arrays - Example

"for" Loop Statements

"while" Loop Statements

Data Type Features

The "decimal" Data Type

Simple Types Are "struct" Types

Type System Unification

Jagged Arrays

Floating-Point Data Types

Precision of Floating-Point Data Types

Precision of Floating-Point Data Types - Test

Performance of Floating-Point Data Types

Performance of Floating-Point Data Types - Test

IEEE 754 Standards - "float" and "double"

IEEE 754 Standards - "float" and "double" - Test

Binary Representation of "decimal"

Accuracy of "decimal" Data Type

Passing Parameters to Methods

Types of Method Parameters

Method Parameter Arrays

Execution Environment Class

System.Environment - Execution Environment Class

Getting Operating System Information

Getting CLR (Common Language Runtime) Information

Visual C# 2010 Express Edition

Downloading and Installing Visual C# 2010 Express

Creating a Visual C# 2010 Project

Compiling and Running a Project

Class Features

"const" and "readonly" Variables

Method Overloading

Properties

Operators

C# Compiler and Intermediate Language

Compiling and Running C# Programs

Compilation - Converting Source Code to Bytecode

.NET Intermediate Language Disassembler

CLR Based PE (Portable Executable) Files

Disassembling Intermediate Language Bytecode

Assembling Intermediate Language Source Code

Compiling C# Source Code Files

C# Compiler "csc" Options

Multiple Classes in a Single Source File

Compiling Multiple Source Code Files Together

Generating and Using .NET Library Files

MSBuild - Microsoft Build Engine

What Is MSBuild?

First MSBuild Project File - Hello.proj

Using MSBuild with Multiple Source Files

Memory Usages of Processes

Using "Process" Class to Show Memory Usages

Private/Virtual Memory and Working Set

Footprints of Private and Shared Memories

Virtual Memory Upper Limit

Memory Report from Windows Task Manager

Memory Report from Performance Console

Multithreading in C#

What Is Multithreading?

System.Threading.Thread Class

Creating and Running Threads

Threads to Run Instance Methods

Performance Impact with Multiple Threads

Multi-Thread Programs on Multi-CPU Systems

Maximum Number of Threads in a Program

Async Feature from C# 5

What Is Async Feature?

GetStringAsync() Method in HttpClient Class

GetStringAsync() Method Example Program

Watching Asynchronous Operation Execution Status

"await" Expression and Child Thread

"await" Expression Thread Example

"async" Function Example

System.IO.FileInfo Class

What Is FileInfo?

Public Properties and Methods of FileInfo Class

Creating FileInfo Objects

FileVersionCopyFile.cs - Testing CopyTo() Method

System.Diagnostics.FileVersionInfo Class

What Is FileVersionInfo?

Public Properties of FileVersionInfo Class

Creating FileVersionInfo Objects

ShowFileVersionInfo.cs - Print File Version Information

Displaying Version Information using Windows Explorer

Displaying Version Information using PE Explorer

WPF - Windows Presentation Foundation

What Is WPF?

System.Windows.Application Class

System.Windows.Window Class

HelloWPF.cs - First WPF Application

System.Windows.Controls Namespace

WPF Button Click Test

Compiling WPF Applications with MSBuild

What Is XAML?

Partial Classes and Partial Methods

What Is Partial Class?

Partial Class Example

What Is Partial Method?

Partial Method Example

Archived Tutorials

Archived: Installing .NET Framework 2.0 SDK

Archived: Installing .NET Framework 1.0 SDK

References

Full Version in PDF/ePUB

Keywords: C#, C Sharp, Language, .NET