当前位置: 首页 > 资源下载 > .NET > 查看资源

资源分类
Web开发
Java
.NET
编程语言
数据库
软件工程
图形动画
系统管理
网络通信安全
计算机理论
考试认证
人文百科
文档手册
硬件技术
办公软件

Visual C# .NET Programming

Visual C# .NET Programming

书名:Visual C# .NET Programming

上传:石头

时间:2009-08-30

文件大小:5.97 MB

资源出处:查看资源出处 >>

收藏到网摘: n/a



作者:Harold Davis
出版日期:2002
出版社:Sybex
页数:548
ISBN:0782140467
文件格式:CHM



Introduction
I dreamed that black-clad horsemen pursued me down a lonely road. Thehoofs of their steeds rang with urgent clanks on the paving stones. Iturned to look at my pursuers and saw fiery red-rimmed eyes fixedwithin deathly pale faces. A sword was raised, and as it swept down…
No, that’s not the way it goes at all.
I dreamed of a city far in the future. Sentient machines performedall menial labor, so there was plenty of time for science and art. Butall was not well in paradise. Regimentation begat alienation, andalienation begat a class of cyber-hackers who had dropped out of knownsociety and lived in caves far from the city.
That’s a little closer, but we’re not quite there yet! Let’s try again.
I dreamed of a pure programming language, so sweet and tender, yetflexible and strong. This language, named after a musical note,incorporated the best features of other languages and also madeavailable an extremely potent library of classes. You guessed it: thelanguage is C#, and the library of classes the .NET Framework. Thisdream is true!
This is a different kind of book about a programming language. Theconventional thing is to begin with syntax and semantics, proceedthrough user interfaces and object orientation, and end with variousapplications. But why be conventional? This book does not do thestandard thing.
To some degree, a book is a compact between writer and reader. Thereader will rightly be disappointed if what they expected to find ismissing. At the same time, no book can be everything for everybody.
In this sense, the compact between writer and reader is analogous tothe implementation of an interface in a class. Everything is spelledout in the interface, so that there is no misunderstanding about how touse an implementation of it.
I expect readers of this book to have some experience withprogramming, or at least be highly intelligent. This is not a book fordummies. (Or, as Mel Brooks exhorted in a different context, “Be asmarty!”)
However, your programming experience need not be with a language inthe “C” family—or even with Java. C# represents a wonderful “next step”for Visual Basic programmers. If you are a VB programmer looking fornew horizons, this book was written for you.
By the way, the one area that seems to trip VB programmers new to C#is type conversion. So if you are a VB programmer new to C#, you mightwant to start with a look at the material explaining type conversion inChapter 6, “Zen and Now: The C# Language.”
I do not promise to be comprehensive or encyclopedic in my coverageof C# or the .NET Framework. For one thing, no single book could everkeep this promise, as the field is so vast. For another, online help isthe best place for detailed answers to many questions—so, asappropriate in this book, I refer you to help topics.
Internal tools such as the Object Browser reveal more informationthan any documentation could—I show you how to make the best use of theObject Browser in Chapter 5, “Reflecting on Classes.”
Finally, most serious programmers—or students of a programminglanguage—have multiple books about the language on their shelves: Inother words, comprehensiveness is found in libraries, and in onlinecompendiums, not individual books.
So if I don’t promise to be comprehensive, what commitments am I making?
First, regarding the code in the book: I’ve tried to provideexamples that you will be able to use in the real world, based on myexperience as a developer. I’ve run and tested every example in thebook. Many of the examples should be usable in whole or part as theyare written.
C# is a graceful language. I’ve tried to write about it in an intelligent, elegant, and humorous way.
I hope you enjoy this book. C# .NET is a powerful, exciting,easy-to-use programming language. The primary goals of my book are to:
Share my excitement and joy in this aesthetically pleasing and productive tool.
Help you to understand the concepts involved in programming with C# and the .NET Framework.
Help you easily produce the code that you need for real projects.
If you read through this book and follow the examples, you willlearn a lot. In contrast to the conventional structure of theprogramming language book, described earlier in this introduction, thenarrative structure of this book involves immersion. You’ll learn bydoing—starting with creating a web service in the first few pages. It’sonly later that the nitty-gritty of language syntax is covered indetail. The idea is that you’ll be having so much fun by then that thepain of mastering the details will be muted.
While we’re on the subject of narrative structure—and, yes,Virginia, even computer books do have narrative structure—let’s talkabout the musical part names of this book.
The Structure of This Book: About the Musical Part Names
Since C# is a programming language named after a musical note, Ithought it appropriate to involve musical concepts when structuringthis book. In keeping with this, I’ve named each of the four parts ofthe book after movements in a classical composition. These movements—prelude, allemande, courante, and gigue—primarily are found in Baroquemusic. Musical scholars should note that I have not been compulsiveabout the accuracy or consistency of the musical metaphor. The pointreally is the metaphor and how it relates to the structure of this bookand to programming in C#.
The structure of the book is essentially spiral, like a chamberednautilus shell or the pattern in this volume’s cover photograph of aZen garden. By the end of the book, readers will be able to comprehendand accomplish things that seemed shadowy and mysterious when theyplunged in at the beginning. Each of the four parts represents adifferent stage in this quest for skills and understanding.
Part 1: Prelude—Service with a Smile
In classical music, the prelude introduces the work. Often composed ina free-flowing style, it sets the mood and mode for the rest of thework and is designed to pique the interest of the audience. It cancontain references to ideas that are delivered later—foreshadowings, ataste of things to come. The themes in the prelude are not whole ideasbut snippets, motifs—just enough to whet the appetite and make thelistener want more. These motifs are pre-echoes— not déjà vu, which arevague memories of things already seen, but rather premonitions ofthings to come. If you listen to the composition more than once, thenin the prelude you should be able to begin to hear the pattern of theentire piece.
At the same time that a prelude introduces the larger work; it is anorganic unit in and of itself, with a beginning, middle, and end. Thiscohesive mini-composition exists within the larger whole and has itsown sense of narrative conflict and resolution, point and counterpoint,all reconciling in a conclusion that serves as an introduction.
Our prelude introduces the theme of the web service. Web serviceshave been hailed by some as revolutionary: a brand new kind of unit ofexecutable code, fit for the distributed environments of the Internetage.
A web service is not an end in and of itself. To actually doanything as a part of a program, it must be used—or, put another way,“consumed.”
It is also the case that this book is not “about” web services; itis about programming in the C# language and the .NET Framework.
Our prelude explores creating a web service, in Chapter 1, “Creatinga Web Service,” and coding ASP.NET web applications to consume the webservice, in Chapter 2, “Consuming the Service on the Web,” as adramatic way to jump into the topics that will form the pattern of thecomposition that is this book. Keep your eyes and ears open forpremonitions that reveal this book’s real themes: the best way to writeC# code for clarity, and patterns and practice of communication betweenobjects.
Part II: Allemande—Striding Forward
The allemande is a movement of great substance that directly followsthe prelude of a musical suite and picks up where the prelude leavesoff. It is stately in manner and can be highly stylized. The allemandecarries forward the mood prefigured in the prelude and introducesgravity into the suite; but the prelude’s free style gives way to theprocessional-like regularity of the allemande.
The sentiments casually introduced in the prelude have become astepping dance with reality—and the allemande keeps it all moving. Themeter is steady and so is the progress. The allemande is stridingforward without hesitation into the future, and the future is now.
Early allemandes come in three sections, or strains, that arerelated but not the same. The second strain contrasts with the firststrain. They resolve in the third and final section, which paves theway for the next movement in the composition.
You can’t have an application without a user interface. Chapter 3,“Windows Uses Web Services, Too!,” is an introduction to programmingthe Windows user interface—while carrying on the web services motifexplicitly introduced in the first part of the book. The allemande alsokeeps one of the underlying themes of this book moving, with anexplanation of the asynchronous communication design pattern.
Chapter 4, “Building a Better Windows Interface,” is about thehard-core plumbing of a Windows interface. Services have been leftbehind. This is the territory of displaying lists of items, menus,common dialogs, and such. This strain of the allemande may be concernedwith conventional Windows development, and it may be a littledissonant, but it has a sense of humor. For example, you’ll start thischapter by making round buttons dance.
The allemande is complete with Chapter 5, “Reflecting on Classes.”We’ve taken strides forward and are now past Windows, in the realm ofobjects and classes. This chapter fits C# code in with the .NETFramework. Once again, it’s about communication. Classes are notislands, and they must be instantiated to be used. It is a time forreflection, for understanding of ourselves and our environment, andalso to soar the peaks of what is possible—knowing that soon we mustreturn to the humble arenas of language and syntax that make it allpossible.
Part III: Courante—The Dance of the Language
The courante is a dance movement of vigor and complexity. It isrhythmically interesting and exciting, but capable of hard work. Acourante combines playfulness and movement with heart, soul, andsubstance.
Courantes were used for dancing in court and in theater, and lateras stylized movements in instrumental music. The form combines rhythmicand metrical fluidity with a complicated texture.
This part, the courante, is in many ways the heart and soul of this book.
We start with Chapter 6, “Zen and Now: The C# Language.” What couldbe more important than a good understanding and grasp of syntax of thebeautiful C# language?
Moving on, Chapter 7, “Arrays, Indexers, and Collections,” shows you how to work with groups of objects—and make them dance.
Chapter 8, “The Life of the Object in C#,” is all about classes andobject-oriented programming. Since all programming in C# is class-basedand object-oriented—the only question is whether the programming isgood object-oriented code or bad object-oriented code—the material inthat chapter is important. I think the running example in Chapter 8 isquite a bit of fun. This program is a simulation based on the ideas ofPulitzer Prize–winning author Jared Diamond. As you’ll see, the programallows users to track the rise (and fall) of tribes and civilizations.
Strings are everything, and everything is string. If you know how tomanipulate strings, you know lots of things—and you’ll find out how inChapter 9, “Everything Is String Manipulation.”
Our courante has proceeded from language and syntax, and onwardthrough arrays, collections, objects, and classes. Coming back to thebeginning, it has explained the sophisticated manipulation of languageelements. This is a complex dance, a spiral within a spiral. As thecourante winds down, we’re ready to move onward—by looking outwardsinstead of inwards.
Part IV: Gigue—Leaping to Success
The gigue—which became a popular Baroque movement—probably originatedin Great Britain as the “jig” or “jigg” (although note that the OldFrench verb giguer means “to leap” or “to gambol”). Whatever thederivation of the word, it’s clear that in Elizabethan times a jig wasa dance—notably performed by Scottish lairds—that involved a great dealof jumping (or, as one contemporary put it, the dance is “full ofleapings”).
In the context of our gigue, this remains true: the movement is fullof leapings. It is happy, exuberant, full of life, and extroverted.
It’s time to turn the knowledge we’ve learned in the early movements outwards—and use the gigue to interact with the world.
Chapter 10, “Working with Streams and Files,” shows you how to work with files—and, generally, how to serialize objects.
Chapter 11, “Messaging,” explains how to program messagingapplications. Using message queues, as you’ll see in Chapter 11, it’spossible to build families of applications that divide workloads andstart and stop each other.
Chapter 12, “Working with XML and ADO.NET,” covers interacting with XML and databases.
Chapter 13, “Web Services as Architecture,” wraps it all up. Comingback to the beginning— after all, Chapter 1 started with a webservice—we can use the sophisticated tools and techniques that we’velearned in order to build web services that are truly exciting! Thechapter concludes with an example showing how to use the TerraServerweb service and display aerial photos or topographic maps of almostanywhere in the U.S. at a variety of magnifications.
And, finally, the gigue is up! Now programming in C# is up to you…
Tags:NETProgrammingVisual


相关书籍

  • Applied Security Visualization
  • 《Oracle Database 11g PL/SQL Programming 》(PDF 英文版)
  • ASP.NET MVC 1.0 Quickly (PDF英文版)
  • Erlang.Programming
  • Cisco Networking Simplified (2nd Edition)

评论 (1) 1 All

登陆 | 还没注册?