Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Csharp and the Dot NET Framework
PREMIUM
Số trang
595
Kích thước
6.1 MB
Định dạng
PDF
Lượt xem
1794

Csharp and the Dot NET Framework

Nội dung xem thử

Mô tả chi tiết

I l@ve RuBoard

• Table of Contents

• Index

C# and the .NET Framework: The C++ Perspective

By Robert Powell, Richard Weeks

Publisher : Sams Publishing

Pub Date : September 26, 2001

ISBN : 0-672-32153-X

Pages : 648

C# and the .NET Framework will guide C++ programmers through the intricacies of the .NET Framework

and its underpinnings while providing a solid understanding of the C# language. The intent is not to try and

give an in-depth byte-for-byte analysis of .NET because that is already provided by the Microsoft

documentation. However, the authors will bring to your attention all the salient points of .NET operations

and give you insights it took over a year to acquire, including coverage of the .NET platform, Intermediate

Language (IL), Common Language Runtime (CLR), C#, Windows Forms, Active Server Pages, COM

interoperability, and threading. You will learn to transition your existing knowledge to .NET through many

code examples. For the die-hard enthusiast, examples are provided for IL and managed C++.

I l@ve RuBoard

I l@ve RuBoard

• Table of Contents

• Index

C# and the .NET Framework: The C++ Perspective

By Robert Powell, Richard Weeks

Publisher : Sams Publishing

Pub Date : September 26, 2001

ISBN : 0-672-32153-X

Pages : 648

C# and the .NET Framework will guide C++ programmers through the intricacies of the .NET Framework

and its underpinnings while providing a solid understanding of the C# language. The intent is not to try and

give an in-depth byte-for-byte analysis of .NET because that is already provided by the Microsoft

documentation. However, the authors will bring to your attention all the salient points of .NET operations

and give you insights it took over a year to acquire, including coverage of the .NET platform, Intermediate

Language (IL), Common Language Runtime (CLR), C#, Windows Forms, Active Server Pages, COM

interoperability, and threading. You will learn to transition your existing knowledge to .NET through many

code examples. For the die-hard enthusiast, examples are provided for IL and managed C++.

I l@ve RuBoard

I l@ve RuBoard

• Table of Contents

• Index

C# and the .NET Framework: The C++ Perspective

By Robert Powell, Richard Weeks

Publisher : Sams Publishing

Pub Date : September 26, 2001

ISBN : 0-672-32153-X

Pages : 648

Copyright

About the Authors

Acknowledgments

Tell Us What You Think!

Introduction

part I. The .NET Framework

Chapter 1.1. A Quick Introduction to .NET

Dispelling the Myth of the .NET Virtual Machine

Microsoft Intermediate Language (IL)

An Introduction to .NET Memory Management

The .NET Framework Type System

The .NET Framework System Objects

C#—A New Programming Language

How Objects Describe Themselves

Component Object Model (COM) Interoperability

Windows Forms, Web Controls, and GDI+

Tools

Assemblies, the .NET Packaging System

Programming with Attributes

Security

Ready, Set, GO!

Chapter 1.2. The Common Language Runtime

Overview

The CLR in Relation to .NET

Summary

Chapter 1.3. IL Intermediate Language

Language Inter-Op

Hello IL

Functions

Classes

ILDASM

Metadata

Reflection API

Summary

Chapter 1.4. Working with Managed Extensions to C++

The C++ Extension Keywords

Using the C++ Compiler for Managed C++

Garbage Collected Classes

The #using Directive

The String

Mixing Managed and Unmanaged Code

Pinning Managed Code

Managed Interfaces

Creating Value Types

Creating and Using Delegates

Calling Custom .NET DLLs from Your Managed C++ Code

Using Managed and Unmanaged C++ DLLs in Your .NET Programs

Using Properties in Your C++ Classes

Ensuring the Alignment and Packing of Your C++ Structures

Summary

Chapter 1.5. Introducing Visual Studio.NET

The Integrated Development Environment (IDE)

Section A: The Main Editing Area

Section B: Solutions, Classes, Items, and Help

Section C: The Toolbox and Server Explorer

Section D: Tasks, Output, Search Results, and Watches

Section E: Properties, Dynamic Help, and Favorites

Debugging Programs

Summary

part II. The C# Language

Chapter 2.1. C# Basics

The C# Type System

Programming Concepts

Arrays

struct

Classes

Interfaces

Delegates

Summary

Chapter 2.2. Advanced C#

.NET Collections

Attributes

XML Serialization

Summary

part III. Windows Forms

Chapter 3.1. Introduction to Windows Forms

The Hello Windows Forms Application

Creating and Using an Event Handler

Defining the Border Style of the Form

Adding a Menu

Adding a Menu Shortcut

Handling Events from Menus

Summary

Chapter 3.2. User Interface Components

Dialogs

Creating Dialogs

Using Controls

Summary

Chapter 3.3. Data Bound Controls

Data Binding Strategies

Data Binding Sources

Simple Binding

Simple Binding to a DataSet

Complex Binding of Controls to Data

Binding Controls to Databases Using ADO.NET

Creating a Database Viewer with Visual Studio and ADO.NET

Summary

Chapter 3.4. Windows Forms Example Application (Scribble .NET)

Resources in .NET

Localization Nuts and Bolts

.NET Resource Management Classes

Creating Text Resources

Using Visual Studio.NET for Internationalization

Image Resources

Using Image Lists

Programmatic Access to Resources

Reading and Writing RESX XML Files

Summary

Chapter 3.5. GDI+: The .NET Graphics Interface

The Basic Principles of GDI+

The Graphics Object

Graphics Coordinates

Drawing Lines and Simple Shapes

Using Gradient Pens and Brushes

Textured Pens and Brushes

Tidying up Your Lines with Endcaps

Curves and Paths

The GraphicsPath Object

Clipping with Paths and Regions

Transformations

Alpha Blending

Alpha Blending of Images

Other Color Space Manipulations

Summary

Chapter 3.6. Practical Windows Forms Applications

Using the Properties and Property Attributes

Demonstration Application: FormPaint.exe

Summary

part IV. Web Technologies

Chapter 4.1. ASP.NET

The New Web

ASP.NET Essentials

Hello ASP.NET

Adding Some Meat

Summary

Chapter 4.2. .NET Data Access

DataLayer

Employee and Department Class

Summary

Chapter 4.3. WebForms

Introduction to ASP.NET WebForms

UserControls

HeaderControl

ASPX Pages

Summary

Chapter 4.4. WebServices

Echo Service

Returning User-Defined Types

XML Attributes

Summary

part V. Component Usage

Chapter 5.1. Assemblies

What Is an Assembly?

Single File Assembly

Multiple File Assembly

Assembly Attributes

Loading Assemblies at Runtime

Summary

Chapter 5.2. Signing and Versioning

DLL Hell

Global Assembly Cache

Versioning

Side-By-Side Assemblies

Custom Binding: Application Configuration

Summary

Chapter 5.3. COM Interoperability

The World of COM

.NET COM Support

Exposing .NET Components as COM Objects

Summary

Chapter 5.4. Threads

Multithreading 101

Thread Synchronization

Extending .NET Threads

Summary

Index

I l@ve RuBoard

I l@ve RuBoard

Copyright

Copyright © 2002 by Sams Publishing

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by

any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from

the publisher. No patent liability is assumed with respect to the use of the information contained herein.

Although every precaution has been taken in the preparation of this book, the publisher and author assume

no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of

the information contained herein.

Library of Congress Catalog Card Number: 2001093492

Printed in the United States of America

First Printing: September 2001

04 03 02 01 4 3 2 1

Trademarks

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately

capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book

should not be regarded as affecting the validity of any trademark or service mark.

Warning and Disclaimer

Every effort has been made to make this book as complete and as accurate as possible, but no warranty or

fitness is implied. The information provided is on an "as is" basis.

Credits

Publisher

Jeff Koch

Acquisitions Editor

Neil Rowe

Development Editor

Kevin Howard

Managing Editor

Matt Purcell

Project Editor

George E. Nedeff

Copy Editor

Pat Kinyon

Indexer

Johnna Dinse

Proofreader

Plan-It Publishing

Technical Editor

Mattias Sjögren

Media Developer

Dan Scherf

Interior Designer

Aren Howell

Cover Designer

Anne Jones

Page Layout

Ayanna Lacey

Dedication

My portion of this book is dedicated to Chrissy, my wonderful wife, who has put up with me sitting at the

computer till the early hours of the morning bashing keys, to my children whom I love dearly, and to my

Dad whom I miss very much because he's on the other side of the pond in England and I don't travel

enough.

—Bob Powell

To my family, things really do always work out for the best.

—Richard Weeks

I l@ve RuBoard

I l@ve RuBoard

About the Authors

Bob Powell is an Englishman abroad. He currently lives in North Carolina with his wife Chrissy and their

children Laurence, Mike, Robyn, Jeremy, Abigail, and Charlie. Currently, Bob is VP of Development at

NetEdge Software Incorporated, a consulting company that provides .NET and C++ software design

services. Bob's e-mail address is [email protected].

Richard Weeks is the CTO and Chief Architect for Crystal Sharp Consulting specializing in .NET

applications development. Richard has been writing software for the better part of 10 years, specializing in

C++, MFC, COM, ATL, and now C#. His major areas of interest include custom control development,

compiler theory, distributed applications development, and design patterns. During the past 10 years, he

managed to make time to earn his B.S. degree in Computer Science from Western Carolina University; it

proudly hangs next to his G.E.D. When not working, he enjoys video games, go-cart racing, and good beer.

Richard Weeks can be reached at [email protected].

I l@ve RuBoard

I l@ve RuBoard

Acknowledgments

Primarily I would like to thank the whole crew at Sams Publishing for their patience in guiding me through

the task of becoming an author. I would also like to thank Eric Andrae, Chris Anderson and Mattias Sjögren

of Microsoft for their help while writing this book.

—Bob Powell

I would like to thank the entire Sams team who worked with Bob and myself on this project. Without the

support of Neil, George and others, this project would certainly not have succeeded. I would also like to

thank Chris Anderson for getting my questions answered and pointing me in the right direction when all

seemed lost.

—Richard Weeks

I l@ve RuBoard

I l@ve RuBoard

Tell Us What You Think!

As the reader of this book, you are our most important critic and commentator. We value your opinion and

want to know what we're doing right, what we could do better, what areas you'd like to see us publish in,

and any other words of wisdom you're willing to pass our way.

As a Publisher for Sams Publishing, I welcome your comments. You can fax, e-mail, or write me directly to

let me know what you did or didn't like about this book—as well as what we can do to make our books

stronger.

Please note that I cannot help you with technical problems related to the topic of this book, and that due to

the high volume of mail I receive, I might not be able to reply to every message.

When you write, please be sure to include this book's title and author as well as your name and phone or

fax number. I will carefully review your comments and share them with the author and editors who worked

on the book.

Fax: 317-581-4770

E-mail: [email protected]

Mail: Jeff Koch

Publisher

Sams Publishing

201 West 103rd Street

Indianapolis, IN 46290 USA

I l@ve RuBoard

I l@ve RuBoard

Introduction

Another platform change is upon us. Just as with the transition from DOS to Windows, we must now move

into the realm of .NET. The .NET platform strives to finally provide a common playing field for all languages

to seamlessly interoperate with a common type system and base class library. Along with this new

platform, Microsoft has created a language specifically designed to take advantage of the .NET platform,

C#, which serves as the basis for this book and the examples herein.

Unlike Visual Basic, Microsoft has submitted both C# and the CLS to the ECMA standards organization to

ensure adoption of the platform and the C# programming language. With open standards as the

cornerstone for the .NET platform, it is sure to gather momentum and an adoption rate that exceeds

proprietary systems and languages. With the introduction of C#, Microsoft has proven once and for all that

the Internet and interoperability are key components for today's software requirements.

The goal of this book is, first and foremost, the exploration of the .NET platform and its underpinnings.

Next, the coverage of the C# language is an essential part of .NET; considering that a vast majority of the

base class library was developed entirely in C#. For the die-hard enthusiast, examples are provided for

Intermediate Language and managed C++.

This book is divided into five parts to give to provide an in-depth look at the major topics in .NET. These

topics include:

.NET Platform

Intermediate language

C#

Windows Forms Development

ASP.NET

COM Interoperability

.NET Threading

As with any new platform, exhaustive coverage of any one topic could easily span a large volume on its

own. Our goal in writing this book is to provide in-depth information about the major areas of .NET, to

provide you with the knowledge required to develop for the .NET platform and to jump start your

productivity. The requirements for software today far exceed what anyone could have envisioned in the

early years of computer programming. The need for Internet-aware, peer-to-peer, XML￾consuming/producing applications requires that programmers have a breadth of knowledge at their

fingertips. The focus from the beginning of this book is to provide you with that breadth of knowledge from

the foundations of .NET all the way to Windows Forms and Web Forms application development. Welcome

to .NET.

I l@ve RuBoard

I l@ve RuBoard

part I: The .NET Framework

1.1 A Quick Introduction to .NET

1.2 The Common Language Runtime

1.3 IL Intermediate Language

1.4 Working with Managed Extensions to C++

1.5 Introducing Visual Studio.NET

IN THIS PART

I l@ve RuBoard

I l@ve RuBoard

Chapter 1.1. A Quick Introduction to .NET

IN THIS CHAPTER

Dispelling the Myth of the .NET Virtual Machine

Microsoft Intermediate Language (IL)

An Introduction to .NET Memory Management

The .NET Framework Type System

The .NET Framework System Objects

C#—A New Programming Language

How Objects Describe Themselves

Component Object Model (COM) Interoperability

Windows Forms, Web Controls, and GDI+

Tools

Assemblies, the .NET Packaging System

Programming with Attributes

Security

Ready, Set, GO!

It is possible that Microsoft has made some of the boldest moves in the computer industry. The enormous

success of DOS was based on a gutsy move by Bill Gates and Steve Ballmer when they told IBM that they

had an operating system to sell. Microsoft did it again with the creation of the most widely used operating

system in the world by plagiarizing the Apple Macintosh's look and feel.

Now, in possibly the boldest move yet, Microsoft has done it again by totally reinventing the way we will use

and program our computers. If you're a programmer of C++, or if you've come to rely on the Windows

operating system or Microsoft Foundation Classes (MFC) for your livelihood, then you will without doubt be

deeply affected by the implications of .NET.

In the recent past the Internet has become the medium in which we do our business, visit our friends, run

our bank accounts, play, chat, and keep in touch with loved ones. This has all been made possible,

practical, and affordable by the software written to perform Internet Protocol (IP) communications for the

World Wide Web. As the Web has grown in capability and complexity, so has the software required to

perform all the millions of IP data transfers to and from our computers. Using e-mail, browsing Web pages,

interacting with databases, and running distributed applications have become more complex, and the

programming skills and techniques required to create and maintain the software have grown more

sophisticated as well. A programmer will often be faced with COM, COM+, DCOM, ASP, SOAP, XML, and XSL

on a daily basis, with an ever-growing array of complex SDKs and manuals to contend with.

Microsoft, like many of us in the industry, has been building up operating systems, toolkits, and applications

incrementally, depending on the requirements of the current technological focus, adding to existing work

with an SDK here and a standard there. The outcome is that operating systems and libraries are not

portable, are top heavy, and are full of add-ins, extensions, and compromises. The .NET framework

radically changes that. It is not an increment, and it is not a consolidation of work. It's a huge, bold, go-for￾it rip that redefines just about everything you know about programming for personal computers of all

shapes and sizes, including the languages themselves.

I l@ve RuBoard

Tải ngay đi em, còn do dự, trời tối mất!