Intermediate C# Tutorials

Roadmap: All Tutorials » C# Tutorials » Intermediate C# Tutorials

Previous: Object-Oriented Programming Tutorials
Next: C# Resources

These C# tutorials are really designed to be the basics, but there's a few other topics that I think deserve some attention. If you're ready to start making games or otherwise move on, you'll be OK skipping these tutorials. Just keep in mind that they're here when you want them, or when you run into something that you haven't seen before.


basics100.png

1 - Writing to and Reading from Files

With an understanding of object oriented programming behind us, this tutorial begins a discussion on some of the random but important other topics in C#. One task that nearly every program requires is the ability to write to a file or read information back in that is stored in a file. This tutorial will cover the basics of file input and output.
1 - Writing to and Reading from Files


basics100.png

2 - Error Handling: Exceptions

What do you do when things go wrong? That's what this tutorial is all about. When things go wrong, you usually end up with what is called an "exception", which is an object that gives you information about what when wrong, and by handling it, we can prevent the program from crashing. This tutorial will cover how to handle exceptions, as well as how to make and "throw" (trigger) your own exceptions.
2 - Error Handling: Exceptions


basics100.png

3 - Delegates

Delegates are a way to treat methods as though they are objects, allowing us to pass them around as parameters to methods or return methods from other methods. They also form the foundation for events, which we'll talk about in the next tutorial.
3 - Delegates


basics100.png

4 - Events

Events, which are built on delegates, are an easy and powerful way for one piece of code to tell another piece of code that something specific has happened. Events are a key part of most GUI driven programs, but even console programs can put them to good use.
4 - Events


basics100.png

5 - Threading

Threading is a programming technique that allows us to run code on multiple processors at the exact same time, making it so your program can run faster, so you can run a task in the background, while another thread keeps a progress bar up-to-date.
5 - Threading


basics100.png

6 - Operator Overloading

We've done a lot with math operations, but this tutorial will show you how you can make it so you can do math with your own classes, using something called "operator overloading". When you're done with this tutorial, you'll know exactly how to use say the '+' operator with your own class!
6 - Operator Overloading


basics100.png

7 - Indexers

Like with operator overloading, indexers allow you to make a custom way for your class to use the indexing operator ('[' and ']').
7 - Indexers


basics100.png

8 - User-Defined Conversions

User-defined conversions are a nice way for us to be able to indicate how our classes can be turned into other types or classes. If it makes sense to be able to convert your class to a similar but different type, this will make it easy to do so. For instance, if you have a MagicNumber class, you can make it so you can turn numbers directly into a MagicNumber, and vice-a-versa.
8 - User-Defined Conversions


basics100.png

9 - Extension Methods

Extension methods are a nifty way to "add" methods to classes that you don't have control over. Technically, we're using a static method that doesn't belong to any class, but with extension methods, C# will magically make it look like the method belongs to the class, which can make your code much more readable.
9 - Extension Methods


basics100.png

10 - Wrap Up

We've covered a ton of C# programming. In fact, more than we really needed to for a "crash course". We've gone into a lot of details that should give you all of the core knowledge you need to go anywhere you want with C#. This "tutorial" will look back on everything we've done, and point out where to go next, now that we're at the end of the C# tutorials!
10 - Wrap Up