Free course · 43 topics · about 65 hours
C# and .NET
Ask or find help in C# and .NET
Type a question or a word. You get the topics, explanations, meanings and quiz answers that cover it, and each result opens at the right place.
Try:
Your timeline: start to finish
About 10 weeks at 1 hour a day (66 study days) · 0/10 modules done
BeginnerWeeks 1–3
5 topics · 2.2 h of lessons · ~6.4 h with practice · you are here
📝 Module 1 exam: Getting started with C# and .NET · 13 questions
- Decisions, loops and methodsWeeks 1–2
4 topics · 2 h of lessons · ~5.9 h with practice
📝 Module 2 exam: Decisions, loops and methods · 13 questions
- Arrays, strings and nullWeeks 2–3
4 topics · 1.8 h of lessons · ~5.4 h with practice
IntermediateWeeks 3–7
- Classes and objectsWeeks 3–4
4 topics · 2 h of lessons · ~5.9 h with practice
- Inheritance, interfaces and recordsWeeks 4–5
4 topics · 2 h of lessons · ~5.9 h with practice
📝 Module 5 exam: Inheritance, interfaces and records · 13 questions
- Collections, generics and LINQWeeks 5–6
4 topics · 2.3 h of lessons · ~6.7 h with practice
📝 Module 6 exam: Collections, generics and LINQ · 14 questions
5 topics · 2.5 h of lessons · ~7.4 h with practice
📝 Module 7 exam: Exceptions, delegates, events and async · 14 questions
ExpertWeeks 7–10
5 topics · 2.8 h of lessons · ~8.3 h with practice
📝 Module 8 exam: Web APIs with ASP.NET Core and EF Core · 14 questions
- Testing, tooling and UnityWeeks 8–9
4 topics · 2.1 h of lessons · ~6.1 h with practice
- Interviews, portfolio and careersWeeks 9–10
4 topics · 2.1 h of lessons · ~6.1 h with practice
📝 Module 10 exam: Interviews, portfolio and careers · 10 questions
Final exam: C# and .NETWeek 10
40 questions · 60 min · pass 70% for the certificate
Weeks count lessons, practice, quizzes and exams (about 65 hours in all), studying every day. Go faster or slower as you like: your place is kept on this device.
0/43 topics done
Beginner
Set up .NET and learn the core language: types, decisions, loops, methods, arrays, strings and null safety. After this you can write and run useful console programs on your own computer.
1Getting started with C# and .NET0/5 topics▼
Learn what C# and .NET are, install the .NET SDK, use the dotnet command line, write your first program, and store numbers and text in typed variables. After this you can create, build and run a small C# console app that reads input, does sums and prints results.
- What C# and .NET areC# (said "C sharp") is a programming language made by Microsoft. .NET is the free, open-source platform that builds and runs C# programs on Windows, Linux and macOS. Your C# code is first compiled to an in-between form called IL, and the .NET runtime turns that into machine code when the program runs.20 min
- Installing .NET and using the dotnet CLIInstall the .NET SDK from dotnet.microsoft.com, then use the dotnet command in a terminal. dotnet new console -o Hello makes a project, dotnet run builds and runs it, and dotnet build only builds it. The .csproj file describes the project: its name, its .NET version and the packages it uses.25 min
- Your first program: output, input and the Main methodA new console app has one line: Console.WriteLine("Hello, World!");. This style, with code straight in the file, is called top-level statements. Older code puts the same line inside a static void Main method in a class. Console.WriteLine prints a line, and Console.ReadLine reads what the user types.25 min
- Types and variablesA variable is a named box that holds a value, and in C# every box has a fixed type: int for whole numbers, double for measurements, decimal for money, bool for true/false, char for one character and string for text. var lets the compiler work out the type, but the type is still fixed. const makes a value that can never change.30 min
- Operators, conversions and parsing inputArithmetic in C# uses + - * / and %, but dividing two ints throws away the fraction: 7 / 2 is 3. To turn typed text into a number use int.Parse, or better int.TryParse, which does not crash on bad input. A cast like (int)9.7 cuts off the decimals, and an int that goes past its limit silently wraps around unless you use checked.30 min
2Decisions, loops and methods0/4 topics▼
Make your programs choose (if, else, switch and switch expressions), repeat (for, while, do-while, foreach) and stay organised with methods that take parameters and return results. After this you can write a menu-driven console app, such as a fee calculator or an ATM simulator, split into small reusable methods.
- Decisions: if, else, switch and switch expressionsif runs a block only when a condition is true, and else if / else handle the other cases. Conditions use comparison operators (==, !=, <, >=) and logical operators (&& and, || or, ! not). A switch picks one of many cases, and the newer switch expression returns a value in a short, readable form.30 min
- Loops: for, while, do-while and foreachA loop repeats a block of code. Use for when you know how many times, while when you repeat until something changes, do-while when the body must run at least once, and foreach to visit every item in a collection. break leaves a loop early, and continue skips to the next round.30 min
- Methods: write once, use many timesA method is a named block of code that does one job. It can take inputs (parameters) and give back a result with return; void means it gives back nothing. Short methods can use the arrow form =>. Splitting a program into small, well-named methods makes it easier to read, test and fix.30 min
- Parameters in depth: optional, named, ref, out, params, overloadingParameters can have default values (optional parameters), and callers can name arguments to make calls clear. Normally arguments are copied in; ref lets a method change the caller's variable, and out lets it hand back extra results, as int.TryParse does. params accepts any number of values, and overloading lets several methods share one name with different parameter lists.30 min
3Arrays, strings and null0/4 topics▼
Store many values in arrays (including 2D and jagged arrays, indices and ranges), work with text using string methods, interpolation, verbatim and raw strings, build long text fast with StringBuilder, and handle missing values safely with nullable types and the ?. and ?? operators. After this you can process lists of marks, clean and format text, and write code that does not crash on null.
- Arrays: one name, many valuesAn array stores a fixed number of values of the same type under one name. You reach each value by its index, starting at 0, so the last one is at Length - 1 (or ^1). C# also has 2D arrays for grids, jagged arrays (arrays of arrays), ranges like arr[1..3], and helpers such as Array.Sort.30 min
- Strings: methods, interpolation, verbatim and raw stringsA string is a sequence of characters, and in C# strings are immutable: methods like ToUpper or Trim return a NEW string and leave the old one unchanged. Interpolated strings ($"...{value}...") build text with values and formats. Verbatim strings (@"...") keep backslashes as they are, and raw string literals ("""...""") hold quotes and many lines easily.30 min
- StringBuilder and string performanceBecause strings are immutable, adding to a string inside a long loop creates a new string every time, which wastes time and memory. StringBuilder keeps one growing buffer that you Append to, and you call ToString() once at the end. Use it when you build text in a loop; for a few joins, plain + or interpolation is fine.20 min
- null, nullable types and null-safe operatorsnull means "no object here". Using a member of something that is null throws a NullReferenceException, one of the most common bugs. int? and other nullable value types can hold null, and nullable reference types (string? versus string) let the compiler warn you before null causes a crash. The operators ?. (call only if not null), ?? (use a fallback) and ??= (assign if null) keep code short and safe.30 min
Intermediate
Object-oriented C#, collections, generics, LINQ, exceptions, delegates, events, async/await, files and JSON. After this you can build well-structured programs that process real data and save it.
1Classes and objects0/4 topics▼
Model real things with classes: fields, constructors and methods; properties with get, set, init and required; access modifiers, static members and encapsulation; and the difference between value types (structs) and reference types (classes). After this you can design small object-oriented programs, such as a bank account or a shopping cart, that protect their own data.
- Classes, objects and constructorsA class is a blueprint that describes what something has (data, in fields) and what it can do (methods). An object is one real thing made from that blueprint with new. A constructor is a special method that runs when the object is created and sets it up. Each object keeps its own copy of the data.30 min
- Properties: get, set, init and requiredA property looks like a field from outside but runs code inside: a get accessor to read and a set accessor to write, where you can check values. Auto-properties ({ get; set; }) need no extra code. init lets a value be set only while creating the object, and required forces callers to set it. In C#, public data is normally exposed as properties, not public fields.30 min
- Access modifiers, static members and encapsulationEncapsulation means keeping an object's data private and letting outside code change it only through safe methods. Access modifiers (public, private, protected, internal) decide who can see each member; class members are private unless you say otherwise. static members belong to the class itself and are shared by all objects, like a counter of how many accounts exist.30 min
- Structs, value types and reference typesC# has two kinds of types. Value types (int, double, decimal, bool, DateTime and your own structs) hold their data directly, so assigning copies the whole value. Reference types (classes, strings, arrays) hold a reference, so assigning shares the same object. Use a struct for small, simple, value-like data; use a class for almost everything else.30 min
2Inheritance, interfaces and records0/4 topics▼
Reuse and extend classes with inheritance (base, virtual, override, sealed), write flexible code with abstract classes and polymorphism, define contracts with interfaces such as IComparable and IDisposable, and model data with records and pattern matching. After this you can design a small class hierarchy, swap implementations behind an interface, and write clear data types and switch logic.
- Inheritance: base and derived classesInheritance lets a new class (the derived class) start with everything an existing class (the base class) has, and add or change behaviour. You write class Savings : Account. A base method marked virtual can be replaced in the derived class with override, and base.Method() still calls the original. A class can inherit from only one class, and sealed stops further inheritance.30 min
- Abstract classes and polymorphismPolymorphism means one piece of code can work with many kinds of objects: a variable of the base type can hold any derived object, and calling a virtual method runs the version of the actual object. An abstract class is a base class that cannot be created on its own and can declare abstract methods that every derived class must implement.30 min
- Interfaces: contracts for behaviourAn interface is a contract: it lists members (methods, properties) that a class promises to have, without saying how. A class can implement many interfaces. Coding against an interface (like INotifier) lets you swap the real implementation, for example SMS for email or a fake for tests. .NET uses interfaces everywhere: IComparable for sorting, IDisposable for cleanup, IEnumerable for foreach.30 min
- Records and pattern matchingA record is a type made for holding data. One line like record Product(string Name, decimal Price); gives you properties, a constructor, value-based equality (two records with the same data are equal), a readable ToString and with-expressions for making changed copies. Pattern matching lets you test the shape of data: its type, property values and ranges, in if statements and switch expressions.30 min
3Collections, generics and LINQ0/4 topics▼
Store and look up data with List<T>, Dictionary<TKey,TValue>, HashSet<T>, Queue<T> and Stack<T>; write reusable, type-safe code with generics and constraints; and query data with LINQ: filtering, sorting, grouping and joining, with a clear understanding of deferred execution and IEnumerable versus IQueryable. After this you can process real data sets, like orders or marks, in a few readable lines.
- Collections: List, Dictionary, HashSet, Queue and StackCollections are ready-made containers that grow and shrink as needed. List<T> is an ordered, resizable list; Dictionary<TKey,TValue> finds a value by its key very fast; HashSet<T> keeps only unique items; Queue<T> is first-in-first-out and Stack<T> is last-in-first-out. Choosing the right one makes code simpler and faster.35 min
- Generics: reusable, type-safe codeGenerics let you write a class or method once with a placeholder type T, and use it with any type while keeping full type checking. List<T> and Dictionary<TKey,TValue> are generic. Constraints like where T : IComparable<T> tell the compiler what T can do, so you can call those members safely.30 min
- LINQ basics: query data in a few linesLINQ (Language Integrated Query) gives every collection methods like Where (filter), Select (transform), OrderBy (sort), First, Any, Count, Sum and Average. You pass small functions called lambdas, such as s => s.Marks > 80, that say what to do with each item. You can also write the same query in a SQL-like query syntax with from, where and select.35 min
- LINQ in depth: grouping, joins, deferred execution, IQueryableGroupBy puts items into groups by a key (orders by city), and Join matches items from two collections by a shared key (orders with customers). Most LINQ queries use deferred execution: they do not run when you write them, but each time you loop over them, so ToList() is used to run once and keep the results. IEnumerable<T> queries run in your app's memory, while IQueryable<T> queries (used by Entity Framework) are translated to SQL and run in the database.35 min
4Exceptions, delegates, events and async0/5 topics▼
Handle errors properly with try, catch, finally and custom exceptions; pass behaviour around with delegates, lambdas, Func and Action; let objects notify each other with events; write non-blocking code with async and await; and read and write files and JSON. After this you can build a console app that loads and saves its data as JSON, calls a web API without freezing, and fails with clear messages instead of crashing.
- Exceptions: try, catch, finally and custom exceptionsAn exception is an object that describes an error, such as a missing file or bad input. When code throws one, .NET skips the rest of the work until a matching catch block handles it; if nothing catches it, the program crashes. finally runs whether or not an error happened. You can throw your own exceptions, and you should rethrow with throw; (not throw ex;) to keep the original details.30 min
- Delegates, lambdas, Func, Action and PredicateA delegate is a variable that holds a method, so you can pass behaviour around like data. Instead of declaring your own delegate types, you usually use the built-in Func<...> (returns a value), Action<...> (returns nothing) and Predicate<T> (returns bool). A lambda such as x => x * 2 is a short way to write the method on the spot. Lambdas can capture variables from around them (closures).30 min
- Events: letting objects notify each otherAn event lets one object (the publisher) announce that something happened, while any number of other objects (subscribers) react, without the publisher knowing who they are. You declare it with the event keyword, usually as EventHandler<T>, subscribers attach with += and detach with -=, and the publisher raises it with ?.Invoke(this, args).25 min
- async and await: waiting without blockingCalls to the network, disk or a database spend most of their time waiting. async and await let your code wait without blocking a thread: the method pauses at await, the thread goes off to do other work, and the method continues when the result arrives. A Task represents work that will finish later (Task<T> also gives a result). Start several tasks and await Task.WhenAll to run them at the same time, and avoid async void and .Result.35 min
- Files and JSON with System.Text.JsonThe File class reads and writes whole files in one line (File.ReadAllTextAsync, File.WriteAllTextAsync), and Path.Combine builds file paths that work on every operating system. JSON is the text format most APIs and apps use to store and exchange data. System.Text.Json turns objects into JSON with JsonSerializer.Serialize and back with JsonSerializer.Deserialize<T>, and JsonSerializerOptions controls details such as indentation and camelCase names.30 min
Expert
ASP.NET Core Web APIs with EF Core, dependency injection and configuration, xUnit testing, solutions and NuGet, a first look at Unity, and interview and career preparation. After this you can build and test a database-backed Web API and apply for junior .NET roles.
1Web APIs with ASP.NET Core and EF Core0/5 topics▼
Build HTTP APIs with ASP.NET Core: minimal APIs and controllers, routing, model binding, validation and status codes; register services with dependency injection and the right lifetime; read configuration safely without committing secrets; understand the middleware pipeline; and store data with Entity Framework Core, migrations and efficient queries. After this you can build and run a small CRUD Web API backed by a database, the kind of task a junior .NET backend developer gets in the first months.
- ASP.NET Core: your first Web APIASP.NET Core is .NET's framework for web apps and HTTP APIs. A Web API receives HTTP requests (GET, POST, PUT, DELETE) and returns data, usually JSON. dotnet new webapi creates a project; minimal APIs map a URL to a lambda with app.MapGet and app.MapPost, while controllers group endpoints in classes. Both are used in companies.35 min
- Routing, model binding, validation and status codesRouting matches the request URL and method to an endpoint. Model binding fills your handler's parameters from the route, the query string, headers or the JSON body. Validation rejects bad input with 400 Bad Request before it reaches your logic. Returning the right status code (200, 201, 204, 400, 401, 403, 404, 409, 500) tells clients exactly what happened.35 min
- Dependency injection and service lifetimesDependency injection (DI) means a class receives the objects it needs (its dependencies) from outside, usually through its constructor, instead of creating them itself. ASP.NET Core has a built-in DI container: you register services in Program.cs with AddSingleton, AddScoped or AddTransient, and the framework creates and passes them where needed. The lifetime decides how long each instance lives.30 min
- Configuration, secrets and the middleware pipelineSettings live outside code: in appsettings.json, appsettings.Development.json, environment variables and, during development, user-secrets, with later sources overriding earlier ones. Secrets such as passwords and API keys must never be committed to Git. Every request passes through a pipeline of middleware components (error handling, HTTPS redirection, authentication, authorization and your own), in the order you add them.30 min
- Entity Framework Core: databases with C#Entity Framework Core (EF Core) is an ORM: it maps your C# classes to database tables, so you query with LINQ and save with SaveChangesAsync instead of writing most SQL by hand. A DbContext represents a session with the database, and each DbSet<T> is a table. Migrations turn changes in your classes into database schema changes. Watch for the N+1 problem and load related data with Include or projections.40 min
2Testing, tooling and Unity0/4 topics▼
Write automated unit tests with xUnit ([Fact], [Theory], Assert, dotnet test), isolate code with interfaces and test doubles, organise real projects with solutions, class libraries and NuGet packages, and take your first steps in game development with Unity's C# scripting. After this you can ship a tested, well-structured .NET solution and write simple Unity scripts that move objects and react to collisions.
- Unit testing with xUnitA unit test is a small piece of code that calls your code with known inputs and checks the result automatically. xUnit is a popular free test framework for .NET: [Fact] marks one test, [Theory] with [InlineData] runs the same test with several inputs, and Assert.Equal(expected, actual) checks the answer. dotnet test builds and runs every test in seconds.35 min
- Test doubles: fakes, stubs and mocksReal code talks to slow or risky things: databases, SMS gateways, payment APIs, the clock. In unit tests you replace them with test doubles: simple stand-ins that implement the same interface. A stub returns fixed answers, a fake is a small working version (like an in-memory store), and a mock records calls so you can check them. Depending on interfaces, as you learned with dependency injection, is what makes this possible.30 min
- NuGet packages, solutions and project structureNuGet is .NET's package manager: dotnet add package downloads a library from nuget.org and records it as a PackageReference in your .csproj. A solution file groups several projects, such as an API, a class library and a test project, and project references connect them. Choosing packages carefully and keeping them updated is part of keeping an app secure.25 min
- Game development with Unity and C#Unity is a widely used game engine, and its scripts are written in C#. A scene contains GameObjects; each GameObject is built from components such as Transform, Rigidbody, Collider and your own scripts. A script is a class that inherits from MonoBehaviour: Start runs once, Update runs every frame, and FixedUpdate runs on each physics step. Multiply movement by Time.deltaTime so the game runs at the same speed on every device.35 min
3Interviews, portfolio and careers0/4 topics▼
Prepare for C# and .NET interviews with clear answers to the questions asked most often, build one portfolio project that proves your skills (a tested Web API with EF Core), understand the real job paths and honest salary ranges in India, and revise the whole course in 30 days. After this you can apply for fresher .NET, ASP.NET Core and Unity roles with a project to show and answers you understand, not just memorise.
- The C# and .NET interview questions asked most oftenMost fresher and junior .NET interviews return to the same core ideas: value versus reference types, boxing, abstract classes versus interfaces, IEnumerable versus IQueryable, async/await, dependency injection lifetimes, garbage collection and IDisposable, records versus classes versus structs, and string immutability. Learn to explain each one in two or three plain sentences with a small example, then practise a few classic coding problems.40 min
- Your portfolio project: a tested Web API with EF CoreOne complete, well-built project tells an employer more than ten half-finished tutorials. Build a small but real Web API, for example a clinic appointment system or a library manager, with ASP.NET Core, EF Core, validation, proper status codes, dependency injection, configuration without secrets, unit tests and a clear README, and put it on GitHub.40 min
- Career paths with C# and .NET in IndiaC# leads to several kinds of jobs: .NET backend and ASP.NET Core developer, full-stack .NET (with React or Angular), enterprise and desktop application developer, Azure cloud developer, test automation engineer, and Unity game developer. Fresher salaries in India are commonly around ₹3.5 to 7 LPA, varying a lot by city, company type and skills. Alongside C#, employers expect SQL, Git and basic web knowledge.25 min
- A 30-day revision plan for the whole courseRevision works best when it is active: write code, explain ideas aloud and test yourself, rather than re-reading notes. This 30-day plan, at about one hour a day, walks back through the course in order, with a small coding task each day, a weekly mini-project, and the final week for mock interviews and your portfolio project.20 min
🎓 Final exam and certificate
40 questions, 60 minutes, pass mark 70%. Pass it to get a certificate with your name.