Note: While reading this page, bear in mind that I'm no computer expert and that the text below may be partly inaccurate. If you find errors or have proposals for improvements, please send me a message and help make this a better page for the benefit of future visitors. To the left, there are links to more C# tutorials.
In the summer of 2010, I started learning how to make GUI A GUI,
Graphical User Interface, includes such things as icons and menus that allows the user of a computer program to do things like open a file or copy some text by clicking the mouse or pressing some keys on the keyboard. programs for the .NET framework, The .NET framwork is a part of the operating system Windows. It's used to build, start and run programs written for the .NET framwork. using Visual Studio 2008 Visual Studio 2008 is a computer program you can use to make new computer programs for the .NET framework. Visual Studio 2010 is the latest version of the program. and C#. C# (pronounced
C sharp) is a programming language designed for building programs for the .NET Framework. As far as I can tell, C# is easier to learn for beginners than, for example, C and C++ but still powerful enough to be used by computer professionals. According to Windows Forms Programming with C# by Erik Brown,
the easiest way to understand C# might be to imagine someone writing down all the annoying aspects of C++ and then designing a language to do away with each item on this list. [...] The C# language was redesigned from the ground up with the idea of retaining the flexibility of C and C++ while formalizing the type system and language syntax. Many common runtime errors in C++ are compiler errors in C# (p. xxix). Since I had been using PHP PHP, Hypertext Preprocessor, is a server-side scripting language. Server-side means that something is done to a web page before it is sent to a visitor's browser, like adding code that makes it possible to send a message or display a new text each time a page is loaded or reloaded, like in the bottom right corner of this page (press F5 a couple of times to see it happen). a couple of years, I wasn't new to coding in general. I was new to writing programs for Windows, though, in C# or any other language, and found myself making lots of rookie mistakes. Even ones I shouldn't have made considering what I already knew about writing source code. Source code is instructions for a computer that a human can read. Source code need to be translated before a computer can understand it.
One reason for many of these rookie mistakes, I think, is that most of the C# tutorials for beginners I found at first focused on mathematical expressions. Since I'm first and foremost writing scripts and programs that deal with words, I'm not that used to writing mathematical expressions and prefer learning about strings, string arrays and other types dealing with strings first when I tackle a new computer language.
Another reason for many of these rookie mistakes, I think, is that most of the tutorials mentioned above focused on how to write console applications. Since I've almost never used console applications and first and foremost want to write applications with a GUI, I'm not that familiar with console applications and not that interested in learning how to write console applications.
I thought it would be nice to provide some C# tutorials with, in most cases, a button and a textbox for C# beginners and perhaps even more advanced C# programmers. The kind of tutorials I was looking for when I started learning how to write C# GUI applications but never found at the time.
Another reason for writing these tutorials is to teach myself C#.
Rewriting a piece of code and try and explain how it works are great ways of learning, I think. After having rewritten a piece of code, I usually understand it better and have often enough also made minor adjustments that makes the code faster or more reliable or improved in some other way. Before you can try and explain how a piece of code works, you need to know not only that the piece of code works but also how.
When I write a tutorial, I look at and run the code line by line and try and explain what happens. Sometimes, that simply means writing down what I already know, but sometimes I'm forced to find more information before I can try and explain what happens. Knowing myself, I'm pretty sure I wouldn't have looked for that information if it hadn't been necessary to accomplish some task, like writing a tutorial.
A third reason for writing these tutorials is to gradually build an archive of relatively well written code (compared to other code I've written). Code I can find easily and reuse in future projects.
I wish I had done something similar when I learned HTML, CSS and PHP. I now have to find code I need in some file or another on some rather badly organised internal or external hard drive or another, which is much more time consuming than finding the code on some rather well organised series of web pages. I will gradually rectify this situation by writing a series of HTML and CSS tutorials and another series of PHP tutorials.
That's why I'm writing these C# tutorials.
To get started, follow these instructions:
1. Go to Downloads at microsoft.com and download the free program Visual C# 2010 Express.
2. Install the program and open it.
3. Click on
Register Product in the Help menu and follow the instructions. You must register Visual C# 2010 Express within 30 days if you want to continue using the program after that period of time.
1. I'm using the default C# color scheme in Visual C# 2010 Express in the code snippets, thinking that's the most helpful approach for most visitors.
2. I focus more on writing instructions on what steps to take to make a piece of code work than on explaining every part of the code; there are, however, short comments on most of the code.
3. The name of a method written by me usually starts with mk (my initials) and continues with the name of the method, for example mkCount.
4. Each tutorial starts with instructions and one or several code snippets and continues (in most cases) with comments on the code. Before reading the comments, I suggest you copy the applicable code snippet to a textbox with line numbers, created with, for example, the free program Visual C# 2010 Express or the free program Notepad++.
More or less useful links
On C# Corner, you can read several hundred articles about, amongst others, C#.
The online book C# Essentials at techotopia.com teches how to write console programs as well as GUI programs.
C# Station teaches how to write C# console programs, but the site is rather well structured and therefore useful to a certain extent.
On Dot Net Perls you can find many useful C# code snippets, that in many cases are benchmarked.
FAQ for .NET Developers gives you short answers to several hundred questions. Be prepared to wait a lot for pages to load, though.
On whoishostingthis.com you can find some basic information about C# and some links to pages on the subject C#.
MSDN Library at msdn.microsoft.com is probably the most comprehensive C# website there is; I doubt it's also the best C# website, though.
The program SharpDevelop is an open-source alternative to the program Visual C# 2010 Express, that seems very good. I've never used SharpDevelop for real, though, so I can't say for sure.
Would you like to comment on this page or some other page? Use the contact form. Write the title of the page you want to comment on and your comment in the field Message.