
The introduction of the course and the reason of why you should learn from this course.
A brief introduction of the tutor.
Introduction of what IDE and Database will be needed for completing this course.
Introduction on how to install Visual Studio 2022 and what kind of packages we are going to install for this course.
Introduction on how to adjust the font size of the code editor and menu bar text of Visual Studio 2022. And also change the project and template paths.
Introduction of downloading and installing Microsoft SQL Server 2019 Express Edition.
Introduction of downloading and installing Microsoft SQL Server Management Studio, also known as SSMS.
We will create our first chatbot, a very simple interactive console application that will answer one question. And then use that to introduce how a C# program works and what is the basic program structure of C# in the following videos. We will improve the functionality of this virtual robot throughout the rest of the videos in this course.
Introduction of how a program could be transformed from source code to an executable file. Basic architecture of .Net Framework, Common Intermediate Language (CIL), Common Language Runtime (CLR), and concept of managed and unmanaged codes are also introduced in this video.
Introduction of what folders and files are created by default when creating a new project and what are the purposes of them. The project file structure of a console app project is used as the example in this video. Even though different types of projects have different file structures, but the concepts behind that are all as the same as console app.
Introduce the most basic program structure of a C# application based on .Net Framework 4.8 console app. A brief introduction of the evolution history of C#, .Net Framework, .Net Core, .Net and Visual Studio is also included at the end of this video. And the resource of the full list of .Net APIs and the most fundamental namespace, the System namespace.
"Top-level statements" is the newest compiler feature of C# language introduced in C# 9.0. It hides boilerplate codes that being used in older C# program templates to enable programmers to write shorter and concise codes. This feature also results in a very different program structure (template) than the one introduced in the last video. So, in this video, we will talk about what this feature is all about and how it works.
Since the first debut of .Net Framework in 2002 till now, there are many different implementations of .Net Framework being released. Some are called .Net Framework, some with the name .Net Core, and the most recent two versions are called .Net. That's quite confusing to many developers who are new to C# and .Net. Therefore, in this video, I will clear that for you.
We build the Part I of the conversation function of the robot application. We will learn how to declare string variables, how to create a static string type user-defined method to generate a randomly selected greeting message then reply to the console. We will also learn how to add code remarks to that user-defined method so that those remarks could be displayed as the usage highlights in the reference popup dialog whenever other method reference it. The selection statement, switch-case, is also introduced in this video. But all functionalities mentioned in this video will be explained in greater details in later videos.
The Part II of the conversation function of the robot will demonstrate how to use an iteration statement to communicate the string type Conversation method created by us repeatedly, in order to imitate human conversation behavior. And in the conversation method, we are going to learn how to utilize the string matching functionality to parse user questions and then return the relative response to the user.
The concept of access modifiers is introduced in this video, as well as the static keyword. After watching this video, you can get a solid idea about when and how to make part of your program to be accessible to the public and when to keep your codes private.
Types are used to define the nature of variables declared in the codes. There are value types, including integral numeric types, floating-point numeric types, Boolean type, char and so on; and reference types, such as string, class, struct... etc. In order for your codes are formatted in a consistent layout, which creates a more readability to others, the C# naming convention, layout convention and commenting convention are also introduced at the end of this video.
We will learn what equality operators and condition comparison operators are and how they work. However arithmetic operators will be introduced in videos of section 5, because section 5 is building the calculation function of the robot. Three kinds of useful expressions are also introduced in this video, including interpolated string expression, lambda expressions and Linq query expressions. We will use these expression to alter the greeting function of the robot.
In this and next videos, we are going to build a full functional Robot class. This video is Part I. We will learn how to create a constructor for a class and learn its purpose. Properties are also introduced, we will learn how to create modifiable properties, read only properties, and even access the assembly information via a property.
This is the Part II of building a full functional Robot class. We will move the greeting and conversation methods from the Program class to the Robot class. And we are going to apply all properties of the Robot class to the greeting and conversation methods. By doing so, the Robot (chatbot) will answers information based on those properties. An nested switch statement is also used in the code.
This is the Part III of building a full functional Robot class. A preliminary version of the Calculator method is created in this video, which use a for loop statement to parse an arithmetic operator and two numbers from a string, then complete the math calculation based on the type of the arithmetic operator. We also improve the console display. During the conversation between the Robot and the user, Robot's name will be displayed in yellow, whereas the user's name will be in white.
Two selection statements, the if statement and the switch statement, are introduced in this video.
Four iteration statements, do, while, for and foreach statement as well as four jump statements, break, return, continue and goto statement are introduced in this video.
In this video, we will recreate the Robot class into a .Net Standard based DLL library to make it reusable and cross platform enabled.
We will use the cross platform DLL library created in the last video to recreate the console chatbot application in .Net 6.
We are going to create a .Net Framework 4.8 Windows desktop application (a.k.a. WinForm) as the graphic user interface (GUI) of our robot application. Starting with this video, we are developing 2 projects, the WinForm project and the reusable MyRobotCore.dll project, in one solution.
We continue to improve the WinForm UI. More WinForm control events and properties will be introduced in this video. We will modify the project file (*.csproj) to let the .Net Framework 4.8 project, which is supported in C# 7.3 by default to be able to utilize the latest C# language version (C# 10.0), so that we can use the global using directive in the code.
In this video we will utilize the System.IO.Directory class to read a text-based .INI file and load the config data in that file to a key-value based Dictionary type variable for later use. Then we will create a Initialize method to load all config data to the properties of the Robot class when a new Robot class instance is initialized in the main form.
In this video, we will talk about how to use try-catch statement to catch errors and to prevent our application from breaking. We will also learn how to utilize ternary conditional operator to distinguish whether a string value is null or empty or not, and how to use the TryParse method of DateTime and int types to handle unexpected errors.
The StreamWriter class is used in this video to write data to a file. We will also utilize the FileNotFound exception and IOException to distinguish from different types of errors. If the FileNotFound exception is intercepted by the try-catch statement, then we use the default settings to auto-generate a new config file and then read all data from the file to properties of the Robot class.
Numeric types casting and conversion are introduced in this video. The use of suffixes for numeric literals, implicit casting, explicit casting between numeric types and the differences between casing and using Convert.ToXXX( ) method are also explained.
The use of the following arithmetic operators are explained in more detail:
Plus (+), Minus (-), Multiply (*), Division (/) and Remainder (%)
Why the outcome of the remainder operation is different from what we expect is explained with a solution.
Increment operator (++) and decrement operator (--)
Compound assignment: +=, -=, *=, /= and %=
Comparison operators: <, >, <= and >=
Bitwise and shift operation of binary form of integral types are introduced in this video.
The unary ~ operator (bitwise complement)
Binary shift operators: << (left shift), >> (right shift)
Binary logical comparison operators: & (logical AND), | (logical OR) and ^ (logical exclusive OR, XOR)
The most commonly used methods of System.Math class are introduced in this video:
Math.Round
Math.Floor
Math.Ceiling
Math.Pow
Math.Abs
Math.Min & Math.Max
Additional two methods of finding the smallest and largest numbers among a series of numbers as well as locates their positions in that number array are also introduced.
In this video we will modify the Robot class to add enum types and overload Calculator methods in the Calculator.cs file. We will also add a floating-point number handler method to deal with decimals, whether to round decimals to a certain digits, or using Floor or Ceiling to transform them to integral numbers.
The Part II of building Robot's calculator function is to create a UI of the calculator. We will achieve this by creating a separate windows form and then link it to the main form of the application for later use. We can trigger the Calculator Form either by issuing a command to the Robot from the main form, or by clicking on a menu bar item named Calculator on the main form.
The Part III of building Robot's calculator function is to create the UI behaviors of the calculator. We will learn how to mark multiple button events which have similar behavior but only send back different values to share the same code definition from the even of one button, in order to avoid creating redundant codes to increase the code maintainability.
We will also learn how to control the display behavior of the calculation process as well as the calculator history. But this video will focus on the calculation of integral numbers.
The final part of building Robot's calculator function is to add the methods for handling floating-point numbers.
This section will create a Schedule booking function for the Robot application, and all scheduled tasks information will be stored in a database. Therefore, the basic concept and the pros and cons of ADO.Net and Entity Framework are introduced in this video.
Service-based Database is a form of local DB that you can include in your application. You can use the visual tool provided by Visual Studio to create a database directly. In this video we will learn how to use it to create a one table database for our Schedule function of the MyRobot application, and then utilize the DataGridView control to read the data from that database without writing any code.
Starting from this video and the next two videos, we are going to utilize ADO.Net to build the CRUD functions, which stand for Create, Read, Update and Delete, to work with a database from scratch. We will add new schedule tasks to the database, update or delete some of them as well. But in this video, we start from building the user interface (UI) first.
In this video, we will use ADO.Net to create the Read function to load data from the database, and then create the Create function to insert new records to the database. And before inserting data to database, we will validate the data content of user inputs before writing them into the database. We will also learn how to enable or disable the Insert button based on the content of input fields.
In this video, we will continue to use ADO.Net to create the Update and Delete functions of updating data to records in the database or to delete a specific row of record.
We will transform the service-based local database to a Microsoft SQL Server hosted database in this video. SQL Server 2019 Express Edition is used in this video.
In this video, we will start to transform the CRUD methods created earlier by using ADO.Net into using Entity Framework. And we will complete the CreateRecord and FindRecord methods first.
We will modify the Update and Delete methods to use Entity Framework in this video.
In this video, we will change several SQL Server settings as well as Windows Defender Firewall Settings to make the SQL Server on that machine could be accessed via IP address in a LAN (Local Area Network) environment.
Before we publish our applications to the users, we will switch the build configuration from Debug mode to Release mode, which makes your application smaller in file size and run faster in execution. This video shows you how to achieve this goal.
ClickOnce is the easiest way to create an installer for your applications.
Microsoft Visual Studio Installer Project is a more powerful tool to create MSI installer for your applications. However it is not included in Visual Studio by default. Therefore, we will download this package from Visual Studio Marketplace for free, and use it to create a more advanced installer for our application.
Brief introduction of WPF and the differences between WPF and WinForm.
How to download the source code of this section.
Create the main WPF UI with transparent background.
Create a separate WPF form for user input and maintaining dialog history. This form will be executed side by side with the main form.
Position the main WPF form and the dialog form to desired spot on the screen as well as to desired size.
Implement the data binding mechanism of WPF to bind the dialog properties of the Robot and the user.
Re-utilize the .Net Standard 2.0 DLL library created in the previous section in the WPF application.
Add some humanized function to the Robot to make more fun!
The introduction of the newly added section which is introducing how to connect our application to the Chat Completion API of OpenAI.
Create an OpenAI account, an API secret key.
The introduction of how the Chat Completion API works.
Here you can download the source code used in this section.
Create the properties and functions that will be used to connect to the Chat Completion API.
Modify the Chat function to be more ChatGPT style.
[Course fourth updated on Jul. 2023 and ChatGPT enabled!]
The goal of this course is to help you learn C# by building and distributing an interesting chatbot application to your users.
According to my experience, the most efficient way to learn new things is to pick up an interesting simple task and complete it from scratch. Since the task is simple and small, it's not hard to finish; and since it is interesting, you won't get bored during the learning process, especially when you get stock in the troubleshooting phases. Therefore, this is also the approach used in this course to help you learn C# easily.
This course is divided into eight sections. Well, actually there are nine sections. Section 4.5 is a brief two-video bonus section. At the end of this course, you will be able to plan a new application, build all its functions, and then encapsulate it in an installer to distribute it to your users. Here is a brief introduction of what you will learn from each section.
Section 1: Introduction
The reason to learn C# programming and the reason to choose this course. You will know who the tutor is and his background to get a solid confidence of choosing this course.
Section 2: Preparing the tools
The steps of downloading and installing Visual Studio 2022, Microsoft SQL Server 2019 Express and Microsoft SQL Server Management Studio (SSMS).
Section 3: Architecture of C# and . Net
To understand C# program structure and . Net Framework architecture. All concepts will be introduced by using a simple interactive console application.
Section 4: C# Essentials
The most basic and necessary concepts of C# language are introduced in this section. And all concepts will introduced by build the core functions of the chatbot program via a console application.
Section 5 Make Reusable Library (original section 4.5)
This is a bonus section, and we are going to create a reusable and cross platform DLL library in . Net Standard for future use.
Section 6: GUI and File Access
We will create a Windows Form desktop user interface for the chatbot, and learn how to load initial settings from a config file. Exception handling will be introduced as well.
Section 7: Database
Two ways of accessing a database, including ADO . Net and Entity Framework, are introduced in this section. We start with using a local database, then transform it to a online SQL database.
Section 8: Program Installer
Two ways of building an application installer for distribute applications, ClickOnce and Microsoft Visual Studio Installer Projects, are introduced.
Section 9: BOT in .Net 6 WPF (Dec. 2022)
Create a WPF application with transparent background.
Section 10: Using OpenAI GPT3 Model (Jul. 2023)
Using C# to create the connectivity of the Chat Completion API provided by OpenAI to make our application more humanized.
What's next?
There are lots of things that you can do with C#, we will let you know what to learn next in this section.