Flylib.com

Books Software

 
 
 

Further Reading


Further Reading

Programming C# , Third Edition by Jesse Liberty , O'Reilly. ISBN: 0596004893.

The Applied Microsoft .NET Framework Programming in C# Collection , Microsoft Press. ISBN: 0735619751.


Part II: Language Fundamentals

 

CHAPTER 2 Introduction to C#

 

CHAPTER 3 Expressions and Control Structures

 

CHAPTER 4 Strings and Regular Expressions

 

CHAPTER 5 Arrays and Collections

 

CHAPTER 6 Objects and Classes

 

CHAPTER 7 File and Stream I/O and Object Persistence

 

CHAPTER 8 XML Fundamentals

 

CHAPTER 9 Multithreaded Programming

 

CHAPTER 10 Events and Delegates

 

CHAPTER 11 Reflection and Code Attributes

 

CHAPTER 12 Assemblies and AppDomains

 

CHAPTER 13 COM and Windows Interoperability

 

CHAPTER 14 High-Performance Programming


Chapter 2. Introduction to C#

IN BRIEF

In this chapter, you will be introduced to various aspects of the .NET Framework, including data types, the Common Language Runtime, and garbage collection. The goal of this chapter is to give you a basic understanding of the .NET Framework, how it works, and how C# is an integral part of that framework. You don't have to have any previous exposure to C# to read this book. Some background and experience with programming in general would be helpful, but is also not necessary.

WHAT YOU NEED

RECOMMENDED SOFTWARE

.NET Framework Visual Studio .NET

RECOMMENDED HARDWARE

.NET-enabled desktop client

SKILLS REQUIRED

Basic programming skills


INTRODUCTION TO C# AT A GLANCE

Why Learn Yet Another Language?

37

   

Learning Common Types

38

   
 

Understanding Value Types

38

Reference Versus Value Types

40

 

Understanding Reference Types

39

   

What Is the Common Language Runtime?

40

   
 

Multiple Languages, One Runtime

42

The JIT Compiler

43

 

Isolation

42

Code Execution

43

 

Platform Invoke

42

COM Interoperability

43

 

Code Access Security

42

Rotor: Microsoft's Shared Source Common Language Infrastructure

44

Take Out the Trash: Theory of Garbage Collection

44

   
 

Reference Counting

44

Partial Collection

45

 

Generations

44

Nondeterministic Finalization

45

 

Collection

45

Using IDisposable to Create Well-Behaved Objects

46

Introduction to the Base Class Library

48

   

The Canonical "Hello World" Example

49

   

Welcome to the .NET Framework. One of the main goals of the .NET Framework is to provide a universal, safe type system through which any language can communicate with managed code written in any other language. By defining a common set of data types, such as int, char, string, and the like, it also provides the ability for an object written in one language to be used and accessed in another language. As a result of the .NET Framework effort, C# was developed to harness the power of the platform. In addition, C# represents an evolution in language design.

C# features many object-oriented features, such as properties for data encapsulation, polymorphic behavior, inheritance, and interface implementation. In addition, C# allows for a developer to tap into unsafe code (discussed later) when performance is at a premium. C# was developed to provide the best aspects of C++, Java, SmallTalk, and Modula2. Elements from each of the languages can be seen in C# and in the Common Language Runtime itself.