Learn C# Online: What You Need to Know to Code in the Language

c stringsMicrosoft C# is a great platform for creating websites, Windows services or even Windows-based client software. Regardless of the reason, the .NET framework is built into Windows, so it’s the most convenient when creating Windows software. The .NET framework includes VB.NET and C#, but C# is easier learned when you come from a C or Java background. Here are some items to look for when you want to learn C# online.

New to .NET? Take an online course at Udemy.com.

Software Needed to Learn C#

There is really only one application you need to code in C#: Visual Studio. Microsoft offers several versions, but the company has an Express version that is free. You can use Visual Studio Express to code basic web applications. The one item Visual Studio Express does not have is Team Foundation Server (TFS), which is a collaboration and code management tool used when more than one person works on a project. It’s also useful to roll back code when you’ve made a mistake in your changes that would be too much to refactor.

You can add SQL Server Management Studio and Express to your software tools. This tool lets you work with SQL Server while using development life cycles. You need a more enterprise solution for live websites and software, but Express versions of SQL Server and Visual Studio get you started with true C# development.

MVC vs Old Web and Windows Forms

The .NET framework originally used web and Windows forms. This type of structure had specific events you coded for including page load, finish load, initialization and unload. You needed to know specifically what each event loaded and unloaded so you could keep track of the state of your controls. Windows and web forms were a great step up from old Classic ASP. Classic ASP was a linear language (and no longer supported by Microsoft), and Windows and web forms are object-oriented frameworks.

The latest programming structure for .NET is MVC. Model-View-Controller (MVC) takes a lot of the hassle away from following page and screen states, and just lets you bind a controller, view and model to a specific page. MVC is typically written in C#. Incidentally, the MVC framework is used in other languages, so you aren’t limited to C# when using the MVC framework.

If you’re just learning, the MVC framework is the way to start. However, you might need to know web and Windows forms when you work in the field. Most jobs require you to know older technology to work with older applications. In some cases, you’ll need to know older languages to upgrade or convert existing applications to newer technology.

Learn .NET from scratch and get started with development at Udemy.com.

Databases: The Key to Dynamic Software

Unless you’re building a local Windows application, you probably need a database. Databases come in all shapes and sizes. Large enterprise solutions use Microsoft SQL Server or Oracle. Smaller development projects can use MySQL or even Microsoft Access. Whatever the solution, you need to know the SQL language, so you’ll need to add SQL to your online C# learning courses.

You can learn the SQL language in tandem with the C# language. This will help you get an overall, well-rounded understanding of how web development works. You can learn just C#, but you’re limited to just front-end development. If you plan to work with full enterprise solutions or even basic website development, you’ll need to understand the SQL language.

Some applications such as Microsoft Access have a wizard that helps you build stored procedures, which are basic coding objects that contain SQL statements that manipulate your data. However, Microsoft Access is usually only useful for small, internal applications. It’s not a good solution for online and web applications.

New to SQL and want to learn databases? Learn now at Udemy.com.

You might wonder what SQL looks like if you’re completely new to web development. The following code is an example of a very simple SQL statement:

select * from users where userid = 5

In the above statement, SQL selects every table column from the “users” table where the user’s Id is 5. This type of statement is typical in a SQL database server. These statements can get complex, but you should start learning SQL with the basics and move on to more advanced statements.

Entity Framework

Entity Framework is a “code first” solution for connecting your databases to the C# application. Entity Framework basically uses classes to define your tables. Visual Studio includes a wizard that helps you connect to your database and create classes automatically. The classes are named after your tables, so if you have a table named “Users,” Visual Studio creates a table named “Users.” Each column is set as a property. Your users’ Ids are set as a property for the “Users” class. You can add methods to these classes, but you usually write methods in a ViewModel class that manipulates data and returns a model to your view from the controller.

Learn LINQ

Language Integrated Query (LINQ) is the foundation for MVC C# projects and Entity Framework. LINQ lets you use queries similar to SQL directly from your C# code. While it’s not exactly the same, it’s extremely useful for returning data sets that work directly with Entity Framework.  LINQ returns an enumeration of a specific data set, and you can loop through it to find and manipulate the records you want to use.

The following code is an example of LINQ:

var users = (from u in db.Users select u);

The above statement gets all users in your Users database and creates an enumerated list in the “users” variable. This is just one example, but you will use a lot of LINQ in standard MVC C# applications. It should be a part of your online C# learning.

If you already know C-based languages like C++ or Java, C# will be easy for you. There’s a lot to learn, but you can probably learn it within a few weeks if you have a foundation for programming, databases and website coding. If you plan to design and develop websites, C# is a must for overall knowledge of web languages.