Microsoft Visual C# 2005 Express Edition: Build a Program Now! (5 page)

Read Microsoft Visual C# 2005 Express Edition: Build a Program Now! Online

Authors: Patrice Pelland

Tags: #General, #Computers, #C♯ (Computer program language), #Programming Languages, #C#, #Microsoft .NET Framework, #Computer Books: Languages, #Computer Graphics, #Application software, #C# (Computer program language), #Programming, #Microsoft Visual C# .NET, #Microsoft Visual C♯ .NET, #Electronic books, #Game Programming & Design, #Computing: Professional & Programming, #C (Computer program language), #Computers - Languages, #Programming Languages - C#, #Programming & scripting languages: general

BOOK: Microsoft Visual C# 2005 Express Edition: Build a Program Now!
13.23Mb size Format: txt, pdf, ePub

13

// Methods

14

public virtual void Display()

15

{

16

Console.WriteLine(Name);

17

Console.WriteLine(Address);

18

Console.WriteLine(City);

19

Console.WriteLine(State);

20

Console.WriteLine(ZIP);

21

Console.WriteLine(Country);

22

}

23 }

24

25

public class Customer : Person

26

27 {

28

public int ID;

29

public bool IsPartner;

30

31

public override void Display()

32

{

33

string partnerMessage;

34

35

if (IsPartner)

36

{

37

partnerMessage = " is a partner";

38

}

39

else

40

{

41

partnerMessage = " is not a partner";

42

}

8

Microsoft Visual C# 2005 Express Edition: Build a Program Now!

CSX_Chapter1.indd 8

CSX_Chapter1.indd 8

10/24/05 2:49:27 PM

10/24/05 2:49:27 PM

43

44

Console.WriteLine("Customer ID: " + ID.ToString());

45

Console.WriteLine(Name + partnerMessage);

46

Console.WriteLine(Address);

47

Console.WriteLine(City + "," + State + " " + ZIP); 48

Console.WriteLine(Country);

49

}

50 }

51

52

public class Employee : Person

53

54 {

55

public int Level;

56

public int Salary;

57

58

public override void Display()

59

{

60

Console.WriteLine(Name + " is at level " + Level.ToString() + " and has a salary of : " + Salary.ToString() + "$");

61

Console.WriteLine("His address is:");

62

Console.WriteLine(Address);

63

Console.WriteLine(City + "," + State + " " + ZIP); 64

Console.WriteLine(Country);

65

}

66 }

This is a simple case, but it illustrates some of the basic concepts of OOP.
What Is Visual C# 2005 Express Edition?

Visual C# 2005 Express Edition is the tool we will use throughout this book to learn how to develop applications running on Windows.

The Express Editions of Visual Studio 2005 were designed to focus on productivity. As with their high-end version counterparts, the Express Editions of Visual Studio 2005 are also what we call Rapid Application Development tools (RAD tools) because their philosophy
Chapter 1: Introducing Microsoft® Visual C#® 2005 Express Edition

9

CSX_Chapter1.indd 9

CSX_Chapter1.indd 9

10/24/05 2:49:28 PM

10/24/05 2:49:28 PM

is geared toward productivity. These new versions of Visual Studio are easy to use, easy to learn, and streamlined because, although they contain mostly the same components, they lack the full breadth of features found in the higher-end versions of Visual Studio. Most features and components in the Express Editions were simplified to make the learning curve less steep and to fit the needs of the nonprofessional developer.

The Visual Studio 2005 Express Edition family is designed with beginning programmers in mind—people like you who are curious about programming and who are looking for an easy way to build Windows applications while learning how to program. Visual C# 2005

Express Edition is the ideal tool to use to rapidly develop applications for topics you really love or for hobbies you enjoy. It can also be used to help ease your day-to-day job or school tasks. Most importantly, you can have fun with the tool while you’re learning to program.
What Kinds of Applications Can You Build with

Visual C# 2005 Express Edition?

With this version of Visual Studio 2005, you’ll be able to create the following types of applications:


Windows Applications
Applications that have a graphical interface with buttons, windows, menus, toolbars, and so on, as in Microsoft Word or Internet Explorer.


Console Applications
Applications that have no graphical interface and simply use text

N O T E

to communicate with the user. (Typically, these are a command window or DOS window.)
We will look into the details of

what types of applications fall into


Reusable Components or Class Libraries
A group of tools created to help build other
these categories in Chapter 2.

applications.

What you won’t be able to build are Web sites and Web services. To create any type of Web application, you will need to get Microsoft Visual Web Developer™ 2005 Express Edition.
10

Microsoft Visual C# 2005 Express Edition: Build a Program Now!

CSX_Chapter1.indd 10

CSX_Chapter1.indd 10

10/24/05 2:49:28 PM

10/24/05 2:49:28 PM

What Are the Key Features You Need to Know About?

The list below, although not complete, provides the essential features of Visual C# 2005

Express Edition. At this point, don’t worry if you don’t understand every single feature listed below. I present the features in the list because you’ll come across all of them in some way in the fun samples that you will be creating.

Most of the features listed here emphasize the RAD
philosophy. Although the idea is to give you an overview of the interesting features that can make your life easier, the feature names alone are not sufficient to understand what they mean. So I include a brief description giving you the essentials and how they should help you to develop applications.


Built-in Starter Kits
Fully developed applications with best practices and examples to follow. These applications will give you another example to base your learning on. They will be a good complement to what we are doing with this book.


Beginner’s Targeted Documentation and Tutorials
A fast and easy way to get the information. They also provide samples.


IntelliSense®
Provides real-life syntax suggestions and even finishes your typing for you.


Code Snippets
Provide code for various programming tasks to help you complete many common tasks automatically. Code snippets show the recommended way of doing things. They are directly integrated in the development environment, and they are extensible; that is, over time Microsoft will continue to supply new code snippets and members of online communities will contribute their snippets as well. Code snippet extensibility seems to be a really nice feature that will help people share useful things in the online communities.


Data-enabled Applications
These applications allow you to connect to Microsoft SQL

Server™ 2005 Express Edition and add databases and code to access these data in your applications.

Chapter 1: Introducing Microsoft® Visual C#® 2005 Express Edition

11

CSX_Chapter1.indd 11

CSX_Chapter1.indd 11

10/24/05 2:49:29 PM

10/24/05 2:49:29 PM


Windows Form Designer
With these new tools, you can easily design your Windows application, including features such as snap lines that make sure your controls are aligned in your form and autocorrect to give you real-time syntax analysis feedback.


XML Web Services
This product provides easy-to-use tools and wizards that will help you connect to published XML-based Web Services and utilize their functionalities.


New Windows Form Controls
These comprise an impressive list of controls—a greater selection than in any previous version of Visual C#. They will help you create user interfaces that have a professional look and feel.


Smart Tags
Most Windows Form controls that come with the product include Smart Tags. As in many Microsoft Office applications, a Smart Tag is represented by a little black triangle or an icon and a little black triangle attached to a control. A Smart Tag gives you access to the most common actions you can perform on a control.


Refactoring
The Visual C# 2005 IDE now includes robust and powerful refactoring support. Refactoring enables developers to automate many of the common tasks when restructuring code. Restructuring the code is when you want to change some of your source code elements and you want to apply that change to all files and occurrences of that element. For instance you’ll be able to rename variables throughout a project, promoting local variables to parameters and many more. It gives you a nice preview feature so that you can see the changes before you make them. You’ll be able to get to the refactoring features either by accessing a context-sensitive menu while editing your source code or by using a smart tag. For more information on refactoring, please visit http://www.refactoring.com/ and for more examples on how those features are implemented in the Visual C# 2005 IDE look at http://msdn.microsoft.com/vcsharp/2005/

overview/productivity/#refactoring.


Click-once Deployment
This features allows you to easily publish your applications on the Internet, on a local area network (LAN), a network share, or on a CD. It also simplifies publishing updates.


Edit and Continue
While you are debugging your application, Edit and Continue lets you modify the code, move back and forth in the debugger, re-execute code, add functionality, or fix bugs on the fly without stopping program execution.
12

Microsoft Visual C# 2005 Express Edition: Build a Program Now!

CSX_Chapter1.indd 12

CSX_Chapter1.indd 12

10/24/05 2:49:29 PM

10/24/05 2:49:29 PM


Debugger Visualizers
While you are debugging your application, the visualizers give you an easy way to get readable representations of your application data. They give you a human-readable representation of the stored data, even for more complex types found in ADO.NET or Extensible Markup Language (XML).


Community Access and Start Page
With these features, you can access additional information from online communities and from different sources of online help, including diverse RSS (Rich Site Summary or Really Simple Syndication) Feeds. (RSS is a family of XML file formats; it is widely used by the weblog community and news Web sites.)


Simplified Development Environment
Everything in the development environment was created so that you can easily access key functionalities, tools, and objects. As you can see, Visual C# 2005 Express Edition includes many nice features to help the new programmer develop applications in a fast and fun way. These features will provide guidance even when you’re not necessarily sure what syntax or components to use and will greatly expedite your learning of the product.

In Summary…

You now know that .NET is a framework composed of compilers, tools, languages, debuggers, and an execution engine. The CLR, or Common Language Runtime, is that execution engine, and it is responsible for loading and executing managed applications. In essence,

.NET is like a house with the CLR as the foundation and all other services built on top of it. You also learned that C# is an object-oriented programming language. You also started to learn what object-oriented programming is and started to learn the basics of OOP in Visual C# 2005.

This chapter has given you the opportunity to learn the features of Visual C# 2005

Express Edition and how you can create three different types of applications that match your hobbies, job, or school needs. In the next chapter, you’ll learn how to install Visual C# 2005

Express Edition.

Chapter 1: Introducing Microsoft® Visual C#® 2005 Express Edition

13

CSX_Chapter1.indd 13

CSX_Chapter1.indd 13

10/24/05 2:49:30 PM

10/24/05 2:49:30 PM

CSX_Chapter1.indd 14

CSX_Chapter1.indd 14

10/24/05 2:49:30 PM

10/24/05 2:49:30 PM

Chapter 2

Installing Visual C#
®

2005 Express Edition

Preparing to Install Visual

In this chapter, you’ll install the product and start getting to know what

C# 2005 Express Edition, 16

components are included with it. I’ll guide you through all the steps of this installation so that you can be ready to start building applications using

Installing Visual C# 2005

Microsoft® Visual C#® 2005 Express Edition right away. I will talk about

Express Edition, 17

some common installation scenarios, give you some tips, and I will also cover what to do if the unexpected happens.

The installation process is easy and straightforward, following in the spirit

Other books

Listening Valley by D. E. Stevenson
Gravity by Dark, Dannika
A Death in the Loch by Caroline Dunford
Among the Believers by V.S. Naipaul
A Thrill to Remember by Lori Wilde
Broken by Skye, Vanessa
A False Dawn by Tom Lowe
Falling for Sir by Cat Kelly
White is for Virgins by Necks, S. Eva