C# 2008 For Dummies
eBook - ePub

C# 2008 For Dummies

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

C# 2008 For Dummies

About this book

Whether you're a total novice or a programmer shifting to C#, the newest version of this programming language is full of cool features you'll want to use. With its Visual Studio compatibility, C# is the perfect language for building Windows Vista applications. And the 2008 version works with LINQ, a query language with syntax similar to SQL but which simplifies database code and can also write queries on XML files.

For the best basic C# how-to, it's hard to beat C# 2008 For Dummies. This plain-English guide to programming with C# can have you creating your first console application before you finish Part I. In fact, the basic template you create at that point will be the foundation of many other apps as you move through the book. Along the way you'll get the scoop on organizing your data, object-oriented programming (also known as OOP), and a great LINQ-related feature called delegates and events. You'll find out how to

  • Create a console application template
  • Perform logical comparisons
  • Work with loops and if statements
  • Understand collection syntax
  • Use interfaces and object-oriented concepts
  • Apply delegates and events, and much more

You'll even gain some rare insight into how to understand error messages you may get when programming in C#. All the code you need can be found on the companion Web site, along with great bonus information that helps you do more with C# 2008. So — what are you waiting for? Grab C# 2008 For Dummies and let's get started!

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access C# 2008 For Dummies by Stephen R. Davis,Chuck Sphar in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in C#. We have over one million books available in our catalogue for you to explore.

Information

Part I

Getting Started with C#

In this part . . .
You have a long way to go before you’ve mastered C#, so have a little fun just to get off the ground. Part I takes you through the steps for creating the most basic Windows console application possible, using Visual Studio 2008. The result gives you the basic C# framework for the example programs that appear throughout this book.
Chapter 1

Creating Your First C# Console Application

In This Chapter

bullet
A quick introduction to programming
bullet
Creating a simple console application
bullet
Reviewing the console application
bullet
Creating the rest of the programs in this book
In this chapter, I explain a little bit about computers, computer languages, C#, and Visual Studio 2008. Then I take you through the steps for creating a very simple program written in C#.

Getting a Handle on Computer Languages, C#, and .NET

A computer is an amazingly fast, but incredibly stupid servant. Computers will do anything you ask them to (within reason), they do it extremely fast — and they’re getting faster all the time.
Unfortunately, computers don’t understand anything that resembles a human language. Oh, you may come back at me and say something like, “Hey, my telephone lets me dial my friend by just speaking his name. I know that a tiny computer runs my telephone. So that computer speaks English.” But that’s a computer program that understands English, not the computer itself.
The language that computers really understand is often called machine language. It is possible, but extremely difficult and error-prone, for humans to write machine language.
Humans and computers have decided to meet somewhere in the middle. Programmers create programs in a language that is not nearly as free as human speech but a lot more flexible and easy to use than machine language. The languages occupying this middle ground — C#, for example — are called high-level computer languages. (High is a relative term here.)

What’s a program?

What is a program? In a practical sense, a Windows program is an executable file that you can run by double-clicking its icon. For example, the version of Microsoft Word that I’m using to write this book is a program. You call that an executable program, or executable for short. The names of executable program files generally end with the extension .EXE. Word, for example, is called Winword.exe.
But a program is something else, as well. An executable program consists of one or more source files. A C# program file is a text file that contains a sequence of C# commands, which fit together according to the laws of C# grammar. This file is known as a source file, probably because it’s a source of frustration and anxiety.
Uh, grammar? There’s going to be grammar? Just the C# kind, which is much easier than the kind most of us struggled with in junior high school.

What’s C#?

The C# programming language is one of those intermediate languages that programmers use to create executable programs. C# combines the range of the powerful-but-complicated C++ with the ease of use of the friendly but more verbose Visual Basic. (Visual Basic’s newer .NET incarnation is almost on par with C# in most respects. As the flagship language of .NET, C# tends to introduce most new features first.) A C# program file carries the extension .CS.
Some wags have pointed out that C-sharp and D-flat are the same note, but you should not refer to this new language as “D-flat” within earshot of Redmond, Washington.
C# is
bullet
Flexible: C# programs can execute on the current machine, or they can be transmitted over the Web and executed on some distant c...

Table of contents

  1. Title
  2. Contents
  3. Introduction
  4. Part I : Getting Started with C#
  5. Part II : Basic C# Programming
  6. Part III : Using Objects
  7. Part IV : Object-Oriented Programming
  8. Part V : Now Showing in C# 3.0
  9. Part VI : The Part of Tens
  10. : Further Reading