Home > Articles > Programming

A C# Programming Tour

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Close Window

James FoxallWendy Haro-Chun

Learn more…

Sorry, this author hasn't written any articles.

Sorry, this author doesn't have anything for sale.

Sorry, this author hasn't posted any blogs.

Sams Teach Yourself C# in 24 Hours

This chapter is from the book
Sams Teach Yourself C# in 24 Hours

Learning a new programming language can be intimidating. This first chapter is designed to build confidence and get you immediately productive with C#. By the time you complete this chapter, you’ll have built a real-world application that lets a user browse his or her hard drive and display a picture on the screen.

See all Sams Teach Yourself on InformIT Programming Tutorials.

"Sams Teach Yourself C# in 24 Hours" is targeted toward those who have little or no programming experience. The book has been structured and written with a purpose, and that is to get you productive as quickly and as smoothly as possible. I have used my experiences from writing large commercial applications to create a book that cuts through the fluff and teaches you what you need to know. All too often authors fall into the trap of focusing on the technology rather than on the practical application of the technology. This book, in contrast, focuses on teaching you practical skills that you can apply immediately toward a development project.

This book is divided into five parts, each of which focuses on a different aspect of developing applications with C#. These parts generally follow the flow of tasks you'll perform as you begin creating your own programs using C#, and include The Visual Studio Environment, Building a User Interface, Making Things Happen – Programming!, Working with Data, and Deploying Solutions and Beyond. It is highly recommended that you read the chapters in the order in which they appear.

—James Foxall

Learning a new programming language can be intimidating. If you've never programmed before, the act of typing seemingly cryptic text to produce sleek and powerful applications probably seems like a black art, and you may wonder how you'll ever learn everything you need to know. The answer is, of course, one step at a time. The first step to learning a language is the same as that of any other activity—building confidence. Programming is part art and part science. Although it may seem like magic, it's more akin to illusion; after you know how things work, a lot of the mysticism goes away, freeing you to focus on the mechanics necessary to produce the desired result.

In this hour, you'll complete a quick tour that takes you step-by-step through creating a complete, albeit small, C# program. I've yet to see a "Hello World" program that's the least bit helpful (they usually do nothing more than print "hello world" to the screen—oh, fun). So instead, you'll create a picture-viewer application that lets you view Windows bitmaps and icons on your computer. You'll learn how to let a user browse for a file and how to display a selected picture file on the screen, both of which are skills that will come in handy in later applications that you create. Creating large, commercial solutions is accomplished by way of a series of small steps. After you've finished creating this small project, you'll have an overall feel for the development process.

The highlights of this hour include the following:

  • Building a simple, yet functional, C# application

  • Letting a user browse a hard drive

  • Displaying a picture from a file on disk

  • Getting familiar with some programming lingo

  • Learning about the Visual Studio—C# IDE

I hope that by the end of this hour, you'll realize just how much fun it is to program using C#.

Starting C#

You must become familiar with a few terms before you begin to create programs in C#:

  • Distributable Component The final, compiled version of a project. Components can be distributed to other people and other computers and do not require C# to run (although the .NET Framework is required, which you'll learn about in coming hours). Distributable components are also called programs. In Hour 22, "Deploying a Solution," you'll learn how to distribute the Picture Viewer program that you're about to build to other computers.

  • Project A collection of files that can be compiled to create a distributable component (program). There are many types of projects, and complex applications may consist of many projects, such as a Windows Application project and support DLL projects.

  • Solution A collection of projects and files that compose an application or component.

C# is a complete development environment; every tool you'll need to create your C# projects is accessed from within Visual Studio. The Visual Studio-C# environment is called the IDE, short for Integrated Development Environment, and it is the design framework in which you build applications. To work with C# projects, you must first start the Visual Studio IDE.

Start the C# IDE now by choosing Microsoft Visual Studio .NET from within the Microsoft Visual Studio .NET folder on your Start menu.

  • Share ThisShare This
  • Your Account

Discussions

Make a New Comment

You must log in in order to post a comment.

Related Resources

Danny KalevMinutes from the October 2009 Meeting
By Danny Kalev on November 19, 2009 No Comments

The minutes from the Santa Cruz (October 2009) meeting are available here. Even if you're not a language layer at heart, I encourage you to read them.

Danny KalevA Reader's Opinion on Attributes
By Danny Kalev on October 20, 2009 No Comments

In August I dedicated a series to the debate about C++0x attributes. I believe that it covered the subject in a balanced and detailed way, but I keep getting complaints from C++ users who don't like attributes for various reasons. Here's a recent email I received from a Polish C++ programmer. While it  doesn't represent my opinion about attributes -- I'm rather neutral about this feature and consider it a "solution waiting for a problem" -- but it suggests that attributes are still a highly controversial issue that will haunt C++ for a long time. The email is quoted here with minor edits that and as usual, with all private details removed.

Danny KalevFollowup: The Web 2.0 Guy I Ain't
By Danny Kalev on October 16, 2009 1 Comment

Almost a year ago, I posted here The Web 2.0 Guy I Ain't. People wonder whether I still resist all those Web 2.0 features and technologies at the end of 2009.

See All Related Blogs

Informit Network