How to Learn C#: Practice, Practice, Practice

c stringsMVC.NET is the latest in the Microsoft .NET Framework. The Model-View-Controller (MVC) structure is not a new concept, and it’s used by several different languages. However, MVC.NET has advantages over the old Microsoft Web Forms. Besides taking some online C# classes, here are some ways you can practice and learn the C# language, which is the basis for the MVC.NET framework.

Getting Started with C#

What languages do you already know? C# is a C-based language, so it might be worth the effort to take a C learning course first. The C# language is an object-oriented programming language (OOP), which is more difficult than linear languages. C is linear, but C++ is OOP. Most college people learn C first and then move on to learning C++. After some C++ training, you’ll get to know OOP.

Linear programming means the compiler just moves straight down the file and each statement runs after the other. OOP uses the concept of classes or objects. You instantiate an object that has a constructor and in that constructor (a function, basically), you initialize values and properties. In an OOP program, you could have a file with five lines of code. However, thousands of lines of code could technically run, depending on the methods and properties within the instantiated classes.

Understanding Classes: The Foundation for C#

Classes incorporate a programming idea called encapsulation. Encapsulated objects contain the methods and properties used to define a part of a program. For instance, most applications have users. These users create accounts, delete accounts, edit accounts and buy product. The following code is an example of a User object:

public class User {

public User() { }

void CreateAccount(string name, string address)


//code to add user to the database



The above class is defined as public. Public classes are available to any other class in your code. Most simple applications use the public keyword. If you make the class private, you can’t instantiate it from several parts of your code.

The “User() {}” section is the constructor. Notice that the constructor has no return type.  The constructor lets you instantiate the code in your applications. Notice the constructor is also defined as public. If you want to create a publically defined class that can be instantiated anywhere in your code, the class and the constructor should be defined as public.

In this example, the constructor takes no arguments. You could technically add arguments. If all of your constructors (you can have more than one) have parameters, then you can only instantiate the class with parameters. For instance, you could change the above code to take a name in the constructor. This would force you to always create a User object with a name, so name can’t be null unless you set it as null in the class code.

The next part in the class is the “CreateAccount()” method. These class methods define a class’ actions. In this example, a name and address are taken as parameters. Although the methods’ code isn’t defined, you can assume that the method will have the code to store a new user in the database. It takes the name and address as parameters. For instance, you might have a form on your website that takes user information. You pass the text box data from the view to the User class.

Learning C# and Becoming an Expert

The above code is just the tip of the iceberg when learning a language. Syntax is easy to learn, but constructing a well-structured application with MVC (or any OOP language for that matter) is much more difficult.

You could learn everything you need to know about C#, but if you don’t practice, you’ll lose what information you learned. Programming languages are just like learning a regular language. If you don’t practice, you lose it. You must practice each programming language you learn. If you already know a C-based programming language, C# will be no problem for you. Java is very close to the C# language, so Java programmers will need little effort to learn it.

Books and blogs are good starting points. Books cost money, but books are a good investment, because you always have them as a reference. This is opposite of blogs that might have pages deleted or the URL expires. The other side to the argument is blogs are free and quick to access. Plenty of bloggers teach programming languages. The problem is that blogs are usually not structured. You can also find ebook instructions.

Video courses for C# are probably the best option. You can refer back to parts you don’t understand, rewind, take additional courses and the videos are usually organized in a way that helps you learn instead of confusing you.

Overall, the best way to learn C# is to learn the syntax and then practice. Create a simple application and then move on to a more complex application. You might have an idea you want to develop. You can learn to work with the language as you develop your application, which is an excellent way to learn how to develop professionally.

Additional Languages to Learn

With the MVC.NET and C# languages and framework, you’ll need some other languages and frameworks under your belt to perform complete development. You’ll need a database language. Most MVC.NET programmers learn MSSQL, which is Microsoft’s database server. Microsoft offers a SQL Server Express version too.

You’ll also need to know jQuery. The jQuery library is deeply embedded in most C# MVC applications. With the jQuery language, you’ll need to know how to work with JSON. There are some open-source JSON libraries available to work fluently with .NET.

Finally, you need to know basic HTML. HTML 5 and CSS3 are both used to make websites responsive, which means that you can access the website from a mobile device and the site fits the device’s screen. Bootstrap is a layout library that uses CSS3 to create mobile websites. Look into these languages and frameworks to get a full understanding of the .NET MVC language.