Professional C# 2005, 3rd Edition

Overview

Professional C# 2005 prepares you to program in C#, and it provides the necessary background information on how the .NET architecture works. It provides examples of applications that use a variety of related technologies, including database access, dynamic web pages, advanced graphics, and directory access. The only requirement is that you are familiar with at least one other high-level language used on Windows—either C++, VB, or J++.

It starts with a tutorial on C# and the...

See more details below
Paperback (Third Edition)
$39.37
BN.com price
(Save 21%)$49.99 List Price
Other sellers (Paperback)
  • All (23) from $1.99   
  • New (5) from $9.12   
  • Used (18) from $1.99   
Sending request ...

Overview

Professional C# 2005 prepares you to program in C#, and it provides the necessary background information on how the .NET architecture works. It provides examples of applications that use a variety of related technologies, including database access, dynamic web pages, advanced graphics, and directory access. The only requirement is that you are familiar with at least one other high-level language used on Windows—either C++, VB, or J++.

It starts with a tutorial on C# and the .NET framework. This introduction assumes no prior knowledge of .NET, but it does move rapidly, on the assumption that the reader is an experienced programmer. Once this background knowledge is established, the book starts to sweep through the vast .NET class library, showing how you can use C# to solve various tasks.  This comprehensive coverage is one of the key selling points of previous versions of the book, and is maintained and enhanced with this new edition by adding new chapters on Generics, ObjectSpaces, Yukon, and Indigo. Some reference material is included either as appendices or is available to download from the Wrox website.

After the introduction and initial chapter, the book is divided into a number of sections that cover both the C# language and its application in a variety of areas. Coverage includes:

  • Writing Windows applications and Windows services
  • Writing web pages and web services with ASP.NET
  • Manipulating XML using C# 2005
  • Understanding .NET Assemblies
  • Using ADO.NET to access databases
  • Integration with COM, COM+, and Active Directory
  • Distributed applications with .NET Remoting
  • Generating graphics using C# 2005
  • Accessing files and the Registry, and controlling .NET security

Using C#, you can write, for example, a dynamic web page, a component of a distributed application, a database access component, or a classic Windows desktop application. Between them C# and .NET are set to revolutionise the way that you write programs and to make programming on Windows very much easier than it has ever been.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Professional C# 2005 will help you master the one language best suited to contemporary .NET development: the Microsoft language that best reflects recent innovations in software development. Yes, that’s C# 2005, a.k.a. Whidbey.

Professional C# 2005 doesn’t just cover the core language: It places C# in the broader context of .NET and shows C# at work supporting database access, dynamic web pages, advanced graphics, access to directory services, and much more.

The authors begin with C# syntax and language elements: variables, data types, flow control, enumerations, arrays, namespaces, classes, structs, inheritance, operators, casts, type safety, operator overloading, delegates, events, memory management, strings, regular expressions, collections, and more. They thoroughly explain (and fully reflect) Whidbey’s major improvements: generics, anonymous methods, iterators, and partial and nullable types, among others. As you've come to expect from Wrox books, there are barrels of code examples.

Next, you'll turn to the .NET environment, including assemblies, Framework security, localization, and deployment. A full section on data access covers ADO.NET, XML, Active Directory, and SQL Server 2005. (The latter, of course, comes with the .NET CLR baked right in, so you can use C# to create stored procedures, functions, and data types.)

The authors walk through creating both Windows and web applications, highlight some key .NET platform improvements, such as ASP.NET master pages. Finally, you’ll find strong coverage of Web services, .NET remoting, and interoperability between .NET and pre-.NET applications: not just backward compatibility with COM, but the use of .NET components within COM applications. Bill Camarda, from the January 2006 Read Only

Read More Show Less

Product Details

  • ISBN-13: 9780764575341
  • Publisher: Wiley, John & Sons, Incorporated
  • Publication date: 10/5/2005
  • Series: Wrox Professional Guides Series
  • Edition description: Third Edition
  • Edition number: 1
  • Pages: 1416
  • Product dimensions: 7.40 (w) x 9.14 (h) x 1.99 (d)

Meet the Author

Christian Nagel is software architect and developer, associate of Thinktecture, who offers training and consulting on how to design and develop Microsoft .NET solutions. He looks back to more than 15 years’ experience as a developer and software architect. Christian started his computing career with PDP 11 and VAX/VMS platforms, covering a variety of languages and platforms. Since the year 2000 — when .NET was just a technology preview — he has been working with various .NET technologies to build distributed solutions. With his profound knowledge of Microsoft technologies, he has also written numerous .NET books; is certified as Microsoft Certified Trainer (MCT), Solution Developer (MCSD), and Systems Engineer (MCSE); and is Microsoft Regional Director and MVP for Visual C#. Christian is a speaker at international conferences (TechED, DevDays, VCDC) and is the regional manager of INETAEurope (International .NET User Group Association) supporting .NET user groups. You can contact Christian via his Web site, http://www.christiannagel.com and http://www.thinktecture.com.

Bill Evjen is an active proponent of the .NET technologies and community-based learning initiatives for .NET. He has been actively involved with .NET since the first bits were released in 2000 and has since become president of the St. Louis .NET User Group (http://www.stlusergroups.org). Bill is also the founder and executive director of the International .NET Association (http://www.ineta.org), which represents more than 125,000 members worldwide. Based in St. Louis, Missouri, USA, Bill is an acclaimed author and speaker on ASP.NET and XMLWeb services. He has written XMLWeb Services for ASP.NET, Web Services Enhancements: Understanding the WSE for Enterprise Applications, Visual Basic .NET Bible, and ASP.NET Professional Secrets (all published by Wiley). Bill is a Technical Director for Reuters, the international news and financial services company. He graduated from Western Washington University in Bellingham, Washington, with a Russian language degree. You can reach Bill at evjen@yahoo.com.

Jay Glynn started writing software nearly 20 years ago, writing applications for the PICK operating system using PICK basic. Since then, he has created software using Paradox PAL and Object PAL, Delphi, VBA, Visual Basic, C, C++, Java, and of course C#. He is currently a Project Coordinator and Architect for a large financial services company in Nashville, Tennessee, working on software for the TabletPC platform. He can be contacted at jlsglynn@hotmail.com.

Karli Watson is a freelance author and the technical director of 3form Ltd (http://www.3form.net). Despite starting out by studying nanoscale physics, the lure of cold, hard cash proved too much and dragged Karli into the world of computing. He has since written numerous books on .NET and related technologies, SQL, mobile computing, and a novel that has yet to see the light of day (but that doesn’t have any computers in it). Karli is also known for his multicolored clothing, is a snowboarding enthusiast, and still wishes he had a cat.

Morgan Skinner began his computing career at a tender age on a Sinclair ZX80 at school, where he was underwhelmed by some code a teacher had written and so began programming in assembly language. After getting hooked on Z80 (which he believes is far better than those paltry 3 registers on the 6502), he graduated through the school’s ZX81s to his own ZX Spectrum.
Since then he’s used all sorts of languages and platforms, including VAX Macro Assembler, Pascal, Modula2, Smalltalk, X86 assembly language, PowerBuilder, C/C++, VB, and currently C#. He’s been programming in .NET since the PDC release in 2000, and liked it so much he joined Microsoft in 2001. He now works in Premier Support for Developers and spends most of his time assisting customers with C#.
You can reach Morgan at http://www.morganskinner.com.

Allen Jones has a career spanning 15 years that covers a broad range of IT disciplines, including enterprise management, solution and enterprise architecture, and project management. But software development has always been Allen’s passion. Allen has architected and developed Microsoft Windows-based solutions since 1990, including a variety of e-commerce, trading, and security systems.
Allen has co-authored four popular .NET books including the C# Programmer’s Cookbook (Microsoft Press) and Programming .NET Security (O’Reilly), and he is actively involved in the development of courseware for Microsoft Learning covering emerging .NET technologies.

Read More Show Less

Read an Excerpt

21: Graphics with GDI+

This is the second of the two chapters in this book that covers the elements of interacting directly with the user, that is displaying information on the screen and accepting user input via the mouse or keyboard. In Chapter 9 we focused on Windows Forms, where we learnt how to display a dialog box or SDI or MDI window, and how to place various controls on it such as buttons, text boxes, and list boxes. In that chapter, the emphasis was very much on using the familiar predefined controls at a high level and relying on the fact that these controls are able to take full responsibility for getting themselves drawn on the display device. Basically, all you need to do is set the controls' properties and add event handlers for those user input events that are relevant to your application. The standard controls are powerful, and you can achieve a very sophisticated user interface entirely by using them. Indeed, they are by themselves quite adequate for the complete user interface for many applications, most notably dialog-type applications, and those with explorer style user interfaces.

However there are situations in which simply using controls doesn't give you the flexibility you need in your user interface. For example, you may want to draw text in a given font in a precise position in a window, or you may want to display images without using a picture box control, simple shapes or other graphics. A good example, is the Word for Windows program that I am using to write this chapter. At the top of the screen are various menus and toolbars that I can use to access different features of Word. Some of these menus and buttons bring up dialog boxes or even property sheets. That part of the user interface is what we covered in Chapter 9. However, the main part of the screen in Word for Windows is very different. It's an SDI window, which displays a representation of the document. It has text carefully laid out in the right place and displayed with a variety of sizes and fonts. Any diagrams in the document must be displayed, and if you're looking at the document in Print Layout view, the borders of the actual pages need to be drawn in too. None of this can be done with the controls from Chapter 9. To display that kind of output, Word for Windows must take direct responsibility for telling the operating system precisely what needs to be displayed where in its SDI window. How to do this kind of thing is subject matter for this chapter.

We're going to show you how to draw a variety of items including:

  • Lines, simple shapes.
  • Images from bitmap and other image files.
  • Text.
In all cases, the items can be drawn wherever you like within the area of the screen occupied by your application, and your code directly controls the drawing – for example when and how to update the items, what font to display text in and so on.

In the process, we'll also need to use a variety of helper objects including pens (used to define the characteristics of lines), brushes (used to define how areas are filled in – for example, what color the area is and whether it is solid, hatched, or filled according to some other pattern), and fonts (used to define the shape of characters of text). We'll also go into some detail on how devices interpret and display different colors.

The code needed to actually draw to the screen is often quite simple, and it relies on a technology called GDI+. GDI+ consists of the set of .NET base classes that are available for the purpose of carrying out custom drawing on the screen. These classes are able to arrange for the appropriate instructions to be sent to the graphics device drivers to ensure the correct output is placed on the monitor screen (or printed to a hard copy). Just as for the rest of the .NET base classes, the GDI+ classes are based on a very intuitive and easy to use object model.

Although the GDI+ object model is conceptually fairly simple we still need a good understanding of the underlying principles behind how Windows arranges for items to be drawn on the screen in order to draw effectively and efficiently using GDI+.

This chapter is broadly divided into two main sections. In the first two-thirds of the chapter we will explore the concepts behind GDI+ and examine how drawing takes place, which means that this part of the chapter will be quite theoretical, with the emphasis on understanding the concepts. There will be quite a few samples, almost all of them very small applications that display specific hard-coded items (mostly simple shapes such as rectangles and ellipses). Then for the last third of the chapter we change tack and concentrate on working through a much longer sample, called CapsEditor, which displays the contents of a text file and allows the user to make some modifications to the displayed data. The purpose of this sample, is to show how the principles of drawing should be put into practice in a real application. The actual drawing itself usually requires little code – the GDI+ classes work at quite a high level, so in most cases only a couple of lines of code are required to draw a single item (for example, an image or a piece of text). However, a well designed application that uses GDI+ will need to do a lot of additional work behind the scenes, that is it must ensure that the drawing takes place efficiently, and that the screen is updated when required, without any unnecessary drawing taking place. (This is important because most drawing work carries a very big performance hit for applications.) The CapsEditor sample shows how you'll typically need to do much of this background management.

The GDI+ base class library is huge, and we will scarcely scratch the surface of its features in this chapter. That's a deliberate decision, because trying to cover more than a tiny fraction of the classes, methods and properties available would have effectively turned this chapter into a reference guide that simply listed classes and so on. We believe it's more important to understand the fundamental principles involved in drawing; then you will be in a good position to explore the classes available yourself. (Full lists of all the classes and methods available in GDI+ are of course available in the MSDN documentation.) Developers coming from a VB background, in particular, are likely to find the concepts involved in drawing quite unfamiliar, since VB's focus lies so strongly in controls that handle their own painting. Those coming from a C++/MFC background are likely to be in more comfortable territory since MFC does require developers to take control of more of the drawing process, using GDI+'s predecessor, GDI. However, even if you have a good background in GDI, you'll find a lot of the material is new. GDI+ does actually sit as a wrapper around GDI, but nevertheless GDI+ has an object model which hides many of the workings of GDI very effectively. In particular, GDI+ replaces GDI's largely stateful model in which items were selected into a device context with a more stateless one, in which each drawing operation takes place independently. A Graphics object (representing the device context) is the only object that persists between drawing operations.

By the way, in this chapter we'll use the terms drawing and painting interchangeably to describe the process of displaying some item on the screen or other display device.

Before we get started we will quickly list the main namespaces you'll find in the GDI+ base classes. They are...

...Almost all the classes, structs and so on. we use in this chapter will be taken from the System.Drawing namespace.

Understanding Drawing Principles

In this section, we'll examine the basic principles that we need to understand in order to start drawing to the screen. We'll start by giving an overview of GDI, the underlying technology on which GDI+ is based, and see how it and GDI+ are related. Then we'll move on to a couple of simple samples.

GDI and GDI+

In general, one of the strengths of Windows – and indeed of modern operating systems in general – lies in their ability to abstract the details of particular devices away from the developer. For example, you don't need to understand anything about your hard drive device driver in order to programmatically read and write files to disk; you simply call the appropriate methods in the relevant .NET classes (or in pre-.NET days, the equivalent Windows API functions). This principle is also very true when it comes to drawing. When the computer draws anything to the screen, it does so by sending instructions to the video card telling it what to draw and where. The trouble is that there are many hundreds of different video cards on the market, many of them made by different manufacturers, and most of which have different instruction sets and capabilities. The way you tell one video card to draw, for example a simple line or a character string may involve different instructions from how you would tell a different video card to draw exactly the same thing. If you had to take that into account, and write specific code for each video driver in an application that drew something to the screen, writing the application would be an almost impossible task. Which is why the Windows Graphical Device Interface (GDI) has always been around since the earliest versions of Windows....
Read More Show Less

Table of Contents

Introduction.

Part I: The C# Language.

Chapter 1: .NET Architecture.

Chapter 2: C# Basics.

Chapter 3: Objects and Types.

Chapter 4: Inheritance.

Chapter 5: Operators and Casts.

Chapter 6: Delegates and Events.

Chapter 7: Memory Management and Pointers.

Chapter 8: Strings and Regular Expressions.

Chapter 9: Collections.

Chapter 10: Generics.

Chapter 11: Reflection.

Chapter 12: Errors and Exceptions.

Chapter 13: Threading.

Part II: The .NET Environment.

Chapter 14: Visual Studio 2005.

Chapter 15: Assemblies.

Chapter 16: .NET Security.

Chapter 17: Localization.

Chapter 18: Deployment.

Part III: Data.

Chapter 19: Data Access with .NET.

Chapter 20: .NET Programming with SQL Server 2005.

Chapter 21: Manipulating XML.

Chapter 22: Working with Active Directory.

Part IV: Windows Applications.

Chapter 23: Windows Forms.

Chapter 24: Viewing .NET Data.

Chapter 25: Graphics with GDI+.

Part V: Web Applications.

Chapter 26: ASP.NET Pages.

Chapter 27: ASP.NET Development.

Part VI: Communication.

Chapter 28: Web Services.

Chapter 29: .NET Remoting.

Chapter 30: Enterprise Services.

Chapter 31: Message Queuing.

Chapter 32: Future of Distributed Programming.

Part VII: Interop.

Chapter 33: COM Interoperability.

Part VIII: Windows Base Services.

Chapter 34: Manipulating Files and the Registry.

Chapter 35: Accessing the Internet.

Chapter 36: Windows Services.

Part IX: Appendices (Web Site Only).

Appendix A: Principles of Object-Oriented Programming.

Appendix B: C# for Visual Basic 6 Developers.

Appendix C: C# for Java Developers.

Appendix D: C# for C++ Developers.

Index.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)