Tags
Language
Tags
December 2024
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 1 2 3 4

A Quick Course On C# 11 .Net Core For Beginners And Advanced

Posted By: ELK1nG
A Quick Course On C# 11 .Net Core For Beginners And Advanced

A Quick Course On C# 11 .Net Core For Beginners And Advanced
Published 11/2022
MP4 | Video: h264, 1280x720 | Audio: AAC, 44.1 KHz
Language: English | Size: 784.55 MB | Duration: 3h 0m

to the point explanation with project downloads for almost every tutorial

What you'll learn
Write professional C# syntax (including C# 11)
You will develop the ability to understand projects written by other professionals
Tutorials are brief and to-the-point
Very helpful for beginners looking for a clean start
Requirements
Some familiarity with at least one language such as C, C++, Java, Python, or even Javascript IS EXPECTED
Description
C# is no doubt a long way from its initial introduction 20 years ago. The syntax at that time was simple - anybody knowing C, Java, C++ could easily get started with C# because the syntax of loops, conditions, inheritance, etc., were so similar. But you must have already noticed that these days a professionally written C# code invariably contains many puzzling punctuators spread here and there - like an exclamation after default -  default!  or exclamation followed by a dot ?.  or => or ?? etc.,. There are many queer looking concepts like statement lambdas, patterns, records, and many-many more like them.You have probably joined me because you want to settle this once for all! I have put a lot of effort in constructing this course to see you through in a small amount of time. PLEASE WRITE TO ME IF YOU FACE ANY PROBLEMS. I WOULD BE HAPPY TO HELP!CHAPTER➤ MAIN METHOD AND TOP LEVEL STATEMENTSMain method is the equivalent of the main method as we know in C language. It's the entry point of your program which means that it is the first function that executes when your program starts its execution. In this tutorial we learn the syntax of this function; we also learn about top-level statements that provide a shortcut to the main function.CHAPTER➤ CLASS, RECORD AND STRUCTWe expect you have a very general understanding of object oriented programming blocks like classes and structs. In this tutorial we have a quick look at a class in C#. Then we have a discussion of the structs, and then a detailed look on the record keyword. The tutorial closes with "When to use a record".CHAPTER➤ STATEMENTS AND EXPRESSIONSThe concept of statements and expressions in C# is exactly the same as in other programming languages. So, this tutorial is a review for the sake of completeness. We have discussed Declaration Statements, Expression Statements, Empty Statement, Nested Statement Blocks, Selection Statements, Iteration Statements, Jumping Statements, Exception Statements, await Statements, fixed Statements and lock Statements.CHAPTER➤ PRACTICE EXERCISE IN C# - 1Write a C# class called CData to hold a float type of quantity. This class also contains an enumeration of two members - Meter and Centimeter - to specify the unit of the quantity stored. Add a constructor and a public function called Convert. The Convert function converts the data to meter if the data held is in centimeters, and to centimeters if the data held is in meters. The Convert function displays the result correct to 2 decimal places. Test the function by creating an object in the main function.CHAPTER➤ REFERENCE AND VALUETYPESValue Types and Reference types are two types in C#. If you are familiar with C and C++, then you can think of reference types as that hold address of objects created on a heap memory. In contrast the value types hold an object. These concepts are far too complex for a beginner's tutorial. So I will try to explain them from a practical standpoint.CHAPTER➤ ANONYMOUS TYPES AND VAR KEYWORDAn anonymous type is described by a comma separated properties clubbed into curly braces. The properties are readonly. The corresponding data-type is generated by the compiler. The name of the data-type remains unknown. It is not accessible in source code. Such types are called anonymous types. They are used to quickly store data without the need of defining a data-type. They are also used in query expressions.CHAPTER➤ STRINGS AND STRING MANIPULATIONIn this tutorial we take common topics on strings, such as creating strings, on concatenation of strings, extraction of a substring, and truncation, null testing, searching a string within another, and comparison of two strings.CHAPTER➤ NULL CONDITIONAL (?. AND ?[]) OPERATORSAn object reference might be null when your code calls a function or accesses a property. Programmers use an if-condition as a safety net and make a null-test on an object that has a possibility of being null at that point. The null conditional operators make it easier to write the code without the if-condition.CHAPTER➤ PRACTICE EXERCISE ON ANONYMOUS TYPESWe have to store four properties of a record - student id of string type and marks in three subjects of Int32 type. Inside main create an array of 10 items. Use a for-loop to fill the array. Each item can be filled with random data. Then, use a select query on the array to project two fields only - Student ID and marks in the first subject. Print the queried data with a suitable loop. Use var keyword as far as possible.CHAPTER➤ PRACTICE EXERCISE ON STRING MANIPULATIONSuppose there is a string s = "aubcd123paqeaw". Write three programs (1) Write a program to count the number of 'a' in this string. (2) Write a program to extract the numeric part into a string variable and display it. (3) Replace all vowels by underscore.CHAPTER➤ METHODS AND REF, IN, PARAMS AND NAMED ARGSFunctions in C# are usually called Methods. They can exist inside a class, struct, record - but not globally outside. So every function, including the Main function must be declared inside a class or a struct. In this tutorial we examine default arguments, named arguments, passing parameters by value and reference, the use of in keyword and finally passing unspecified number of arguments with the params keyword.CHAPTER➤ DELEGATES, LAMBDA EXPRESSIONS, ACTION AND FUNC DELEGATESIn this tutorial we learn about delegates that are a data-type for a function signature. In this context a function signature includes the return type and the arguments of a function, but doesn't include the name. We also learn about lambda expressions and built-in delegates called Action and Func delegates.CHAPTER➤ PROPERTIES AUTO-IMPLEMENTED, INIT, READONLY, REQUIREDThe concept of a property is the most widely used in dotnet programming. Properties provide setter and getter functions for validation of data before it enters or leaves your object. A property has a specific syntax that needs to be mastered.CHAPTER➤ EXPRESSION-BODIED MEMBERSIf a function consists of only one statement or expression, then the braces and the return keyword could be redundant. Thus, we can simplify such functions by removing the braces and the return keyword. The result is that the overall look of the function becomes simplified, and it becomes easier to read. Functions, properties, operators, and indexers that use this syntax are called expression-bodied members.CHAPTER➤ PRACTICE EXERCISE IN C# - DELEGATESCreate a class MyClock that contains only one public function "void Tick(Object?)". This signature matches the signature of the TimerCallback delegate defined in the System.Threading.Timer class of dotnet. The "void Tick" function prints the current system time on the console (use DateTimeNow). Inside Main create a System.Threading.Timer by using a suitable constructor that calls "void Tick" once every second. Run the program to verify that you have a clock that prints the current system time. You will have to study the documentation of System.Threading.Timer class.CHAPTER➤ PRACTICE EXERCISE ON PROPERTY CHANGED EVENT AND LAMBDASCreate a class called MyNumber with a property called Number of Int32 type. This class should contain an event delegate that takes one argument of Int32 type. The class MyNumber should raise this event when the Number property changes. The changed value should be sent as an argument to all delegates that register to this event. Inside Main create an object of MyNumber and attach an event handler that prints the changed value. The event handler should be an anonymous expression lambda that receives an Int32 argument and prints the number to console. Test the project by changing the Number property. If you did the things correctly, then you should see the event handler called. This might be a difficult one. So please go through the solution if you find the question itself difficult to understand.CHAPTER➤ INHERITANCE AND PROTECTED AND SEALED KEYWORDSInheritance in C# is similar to what we have in other object oriented languages. In this tutorial we take a short example to get introduced to the syntax. We also learn about the protected and sealed keywords.CHAPTER➤ POLYMORPHISM IN C#This tutorial is for explaining a few programs that exhibit the idea of polymorphism. I won't be able to go into the philosophy of polymorphism. The whole point of this tutorial is to introduce you to the syntax, and about how the usual things are done in a C# syntax.CHAPTER➤ HOW AND WHY OF STATIC CLASSESA static class is a container for self-contained static functions that just operate on the input operators. The concept of a static class and static members is essentially the same as in other object oriented languages like C++ and Java. static classes provide simplicity but they are not a part of pure object oriented design. The general guidelines are to use static classes only SPARINGLY in your projects. In this tutorial we learn about the features of a static class in C#.CHAPTER➤ STATIC AND CONST MEMBERSOnly one copy of a static data member exists in the entire program. A const member behaves like a static, but it's value is marked as fixed and constant. The compiler knows its value. Therefore it can make substitutions and avoid memory allocation for a const member. Let's see the finer details.CHAPTER➤ PRACTICE EXERCISE IN C# - STATIC AND CONSTThis exercise is an exercise just for the sake of practice in static and consts in a class. Create a class called CBankAccount that contains a static member to hold the name of the bank, a constant member to store the minimum balance (100) that a customer has to maintain, another constant member for rate of interest (5) and a yet another constant member for periodicity (4 months) of applying interest. Also add an instance member to hold the balance of a customer in dollars. Add a static constructor to initialize the name of the bank by obtaining input from the user. Add a static function called RenameBank that can be used to give a new name to the bank. Add two functions called Withdraw(int amount) and Deposit(int amount) that update the balance after a successful transaction and print it. Also add a function AddInterest() that calculates simple interest for four months and updates the balance. Test the class in Main.CHAPTER➤ GENERICSIn this tutorial we take a hypothetical problem to build towards the concept of generics. First we explore a few bad solutions. Then we explain a perfect solution by generics. That leads us to list the benefits of using generics. We conclude with the constraints on generic parameters.CHAPTER➤ ARRAYS - JAGGED AND MULTI-DIMENSIONALArray can be used to store many variables of the same type. An array can be of one dimension, can be of multiple dimensions and can even be a jagged array, which is commonly called an array of arrays. The size of an array is decided at the time of creation, and cannot be altered later.CHAPTER➤ COLLECTIONSA collection class holds objects. We have seen that arrays also hold objects. The size of an array is fixed at the time of creation, but collections can grow and shrink as per need. Some collections can assign keys  to the objects they hold. The elements can be accessed with a key like we have a dictionary.CHAPTER➤ LINQ - IENUMERABLE, YIELD AND ENUMERATORThis tutorial introduces you to the IEnumerable interface and its practical significance. After that we discuss the internal workings of this interface. We demonstrate how the yield keyword can be used to return an IEnumerable from a function. The tutorial concludes with a C# program to efficiently print a fibonacci series by using the yield keyword and statement.CHAPTER➤ LINQ - SELECT, WHERE, ORDERBY AND ORDERBYDESCENDINGIn this tutorial we learn the use of Select, Where, OrderBy and OrderByDescending functions provided by C# LINQ. A program has been used to explain these functions. This will help you get started but experience is the best teacher. So all I can help you is get started.CHAPTER➤ LINQ - FIRSTORDEFAULT, SINGLE, FIRST, SINGLEORDEFAULTIn this tutorial we learn about FirstOrDefault, Single, First and SingleOrDefault extension methods available on an IEnumerable. Use FirstOrDefault for finding the first element that matches a condition. It returns the default value if no matching records exist. "First" does the same thing but throws an exception instead. SingleOrDefault returns the default value if exactly one record cannot be found. There is one more called Find which should be used if the search has to be by a primary key value.CHAPTER➤ LINQ - GROUPBYC# Linq provides a GroupBy extension method for grouping records on a common key. This tutorial starts with a brief introduction to the concept of grouping. Then we use the GroupBy extension to group various records on a property called last name so that customers of the same last name are grouped together. The result is then displayed on console.CHAPTER➤ LINQ - JOINTwo lists can be joined on common key or keys by using the Join extension method. The concept of a join in linq is exactly the same as in SQL of databases. A detailed concept of joins is far too complex to be described in a single tutorial. So this tutorial has been kept simple to help you get started and walk you to a point where a further study is easier.CHAPTER➤ PRACTICE EXERCISE ON GROUPJOINCreate a list of Category records with ID and Name as properties. Add 3 items to this list - (ID:1, Name:"For Men"), (2, "For Women") and (3, "For Kids"). Then create a list of SubCategory records with ID, Name and CategoryFK as properties. The property CategoryFK is a foreign key for the ID property of a Category. Add these items - (ID:1, CategoryFK:1, Name:"Shirts"), (2, 1, "T Shirts"), (3, 1, "Trousers"), (4, 2, "Skirts"), (5, 2, "Shoes"). Use the GroupJoin extension to present dresses of men under a heading "For Men", dresses of women under "For Women" and likewise for kids.CHAPTER➤ EF CORE - CREATING A DATABASEDatabase connectivity is required in almost every project. It is best done with the help of EF Core libraries. The good thing is that the steps for database connectivity are fairly standardized now. The same steps are used for C# console applications, the same are for a C# winforms, C# WPF and even C# web applications. This tutorial walks you through the steps required for creating a database. In the next tutorials we shall explain the create, read, update and delete operations.CHAPTER➤ EF CORE - COMPLETE CRUD EXAMPLE CONSOLE APPLICATIONThis tutorial continues from the previous tutorial where we created a database and a table in it. We shall now add a blog record to the table and save it. Then we shall extract it back and make a change to the Heading property, and save it again. Then we shall extract it back and delete it from the table. Finally, we shall display the count of records in the table, and verify that it is shown zero.CHAPTER➤ FUNCTIONAL TECHNIQUES - DISCARDSDiscards are denoted by an underscore. They can be thought of identifiers that receive an assignment, but the assignment is discarded and not available for use. A discard is most commonly used to indicate that the return type of a function has been ignored intentionally. But there are other less known use-cases of a discard. This tutorial demonstrates them by using various program examples - using a discard to (1) ignore a function return, (2) ignore the return of a tuple, (3) ignore an out parameter of a function, (4) default case of a switch expression and (5) as a forced assignment.CHAPTER➤ FUNCTIONAL TECHNIQUES - PATTERN MATCHINGPattern matching is used to test an expression. In this tutorial we take various snippets to learn expression matching. One of the uses is to test if a variable matches a data type. Pattern matching is also used in switch expressions to match  the arms against constants, strings or logical conditions. Pattern matching is also used for comparison of multiple inputs passed as expressions of tuple types. Lists can also be matched if you are using C# 11 or later.CHAPTER➤ REFLECTIONReflection is used to obtain information about the functions, properties, events, fields of a given Type of dotnet. For example, we can use reflection to query the constructors and methods of the System.String class. We can even use Reflection to execute the methods queried through Reflection. We can use Reflection to obtain a description about the assembly that contains a given Type. Please do, however, take note that this is not something that is done very commonly - it's available when you need it.CHAPTER➤ ASYNCHRONOUS TASK PROGRAMMINGAn application is often required to make database access, perform file read and write or contact internet for communication. All these tasks involve time consuming operations that make the main thread too busy. This causes the application to hang and freeze while the main thread waits for a large file to download. The solution to this problem lies in asynchronous task programming. A potentially long and time consuming operation can be run in parallel in such a way that the UI (user interface) remains responsive and, possibly, provides a progress feedback to the user. Let's explore it in this tutorial!CHAPTER➤ EXCEPTIONS AND ERRORSA function throws an exception on failure. The functions that are expected to fail are written inside try blocks with one or more catch blocks. Each catch block handles a specific reason of failure. A catch block receives an exception object which is often used to obtain a detailed information of the cause of failure.

Overview

Section 1: Getting Started, Main, Top-level Statements, class, record, struct, naming

Lecture 1 Creating your First Program

Lecture 2 Main Method and Top Level Statements

Lecture 3 class, record and struct

Lecture 4 Statements and Expressions

Lecture 5 Program Example

Section 2: Data Types

Lecture 6 Reference and Value Types

Lecture 7 Anonymous types and var Keyword

Lecture 8 Strings and String Manipulation

Lecture 9 Null-conditional Operator

Lecture 10 Program Example - Anonymous Types

Lecture 11 Program Example - String Manipulation

Section 3: Methods and Functions

Lecture 12 Methods ref, in, params, named Args

Lecture 13 Action, Func Delegates and Lambda Expressions

Lecture 14 Properties Syntax

Lecture 15 Expression Bodied Members

Lecture 16 Program Example - delegates

Lecture 17 Program Example - Properties and Events

Section 4: Inheritance, Polymorphism, Interfaces and Generics

Lecture 18 Inheritance

Lecture 19 Polymorphism

Lecture 20 How and Why of static classes

Lecture 21 static and const Members

Lecture 22 Interfaces

Lecture 23 Program Example - Static Constants

Section 5: Generics

Lecture 24 Generics

Section 6: Collections and Arrays

Lecture 25 Arrays - Jagged and Multi-dimensional

Lecture 26 Collections

Section 7: LINQ

Lecture 27 IEnumerable, yield and Enumerator

Lecture 28 Select, Where and OrderBy

Lecture 29 FirstOrDefault, SingleOrDefault

Lecture 30 Grouping

Lecture 31 Join

Lecture 32 Program Example - GroupJoin

Section 8: Entity Framework Core for Console Applications

Lecture 33 Setting up a console project for database

Lecture 34 Complete CRUD Console Project

Section 9: Functional Techniques

Lecture 35 Discards

Lecture 36 Pattern Matching

Lecture 37 Reflection

Lecture 38 Asynchronous Programming async await

Lecture 39 Exception Handling

This course is for almost everyone because C# is a philosophy that needs ONE CLOSE reading.