Learn c

Solo disponible en BuenasTareas
  • Páginas : 97 (24122 palabras )
  • Descarga(s) : 0
  • Publicado : 7 de noviembre de 2010
Leer documento completo
Vista previa del texto
Learn C#
Includes the C# 3.0 Features

Sam A. Abolrous

Wordware Publishing, Inc.

Library of Congress Cataloging-in-Publication Data Abolrous, Sam A. Learn C# / by Sam A. Abolrous. p. cm. Includes index. ISBN-13: 978-1-59822-035-3 (pbk.) ISBN-10: 1-59822-035-7 1. C# (Computer program language) I. Title. QA76.73.C154A416 2007 005.13'3--dc22

2007024261

© 2008, Wordware Publishing,Inc. All Rights Reserved 1100 Summit Avenue, Suite 102 Plano, Texas 75074

No part of this book may be reproduced in any form or by any means without permission in writing from Wordware Publishing, Inc. Printed in the United States of America

ISBN-13: 978-1-59822-035-3 ISBN-10: 1-59822-035-7 10 9 8 7 6 5 4 3 2 1 0708

All brand names and product names mentioned in this book are trademarks orservice marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks should not be regarded as intent to infringe on the property of others. The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. This book is sold as is, without warranty of any kind, either express orimplied, respecting the contents of this book and any disks or programs that may accompany it, including but not limited to implied warranties for the book’s quality, performance, merchantability, or fitness for any particular purpose. Neither Wordware Publishing, Inc. nor its dealers or distributors shall be liable to the purchaser or any other person or entity with respect to any liability, loss,or damage caused or alleged to have been caused directly or indirectly by this book.

All inquiries for volume purchases of this book should be addressed to Wordware Publishing, Inc., at the above address. Telephone inquiries may be made by calling: (972) 423-0090

To Camelia, my love and my wife.

This page intentionally left blank.

Contents
Foreword. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . xiii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Chapter 1

Introduction to C# and .NET . . . . . . . . . . . . . . . . . . . . 1 1-1Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . 1 1-2 C#: The OOP Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-3 The .NET Framework. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1-3-1 CLR and Managed Code. . . . . . . . . . . . . . . . . . . . . . . . . . 3 1-3-2 MSIL and JIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 1-3-3 Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1-3-4 Assemblies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1-3-5 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1-3-6 Putting Things Together . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1-3-7 ILASM and ILDASM . . . . . . . . . . . . . . . . . . . .. . . . . . . 6 1-4 A First Look at the C# Code . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1-4-1 The C# Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1-4-2 The IL Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1-4-3 The Manifest. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1-4-4 Using the Library File . . . . . . . . .. . . . . . . . . . . . . . . . . . 9 1-5 How to Get a Free C# Compiler . . . . . . . . . . . . . . . . . . . . . . . . 10 1-5-1 Compiling Programs in the Command-Line Environment . . . . . . . . 11 1-5-1-1 If You Have the Compiler without the IDE . . . . . . . . . . . . 11 1-5-1-2 If You Have the Visual Studio IDE . . . . . . . . . . . . . . . . 12 1-6 Comparison of C# and C++ . . . . . . . ....
tracking img