• Complain

Rod Stephens - C# 5.0 Programmers Reference

Here you can read online Rod Stephens - C# 5.0 Programmers Reference full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2014, publisher: John Wiley & Sons, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Rod Stephens C# 5.0 Programmers Reference
  • Book:
    C# 5.0 Programmers Reference
  • Author:
  • Publisher:
    John Wiley & Sons
  • Genre:
  • Year:
    2014
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

C# 5.0 Programmers Reference: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "C# 5.0 Programmers Reference" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Stay ahead of the game with this comprehensive guide to the C# programming language Well-known C# expert Rod Stephens gives novice and experienced developers a comprehensive tutorial and reference to standard C#. This new title fully covers the latest C# language standard, C# 5.0, as well as its implementation in the 2013 release of Visual Studio. The author provides exercises and solutions; and his C# Helper website will provide readers and students with ongoing support. This resource is packed with tips, tricks, tutorials, examples, and exercises and is the perfect professional companion for programmers who want to stay ahead of the game. Author Rod Stephens is a well-known programming authority and has written more than 25 programming books covering C#, Java, VB, and other languages. His books have sold more than 150,000 copies in multiple editions. This books useful exercises and solutions are designed to support training and higher education adoptions. Learn the full range of C# programming language features Quickly locate information for specific language features in the reference section Familiarize yourself with handling data types, variables, constants, and much more Experiment with editing and debugging code and using LINQ Beginning through intermediate-level programmers will benefit from the accessible style of C# 5.0 Programmers Reference and will have access to its comprehensive range of more advanced topics. Additional support and complementary material are provided at the C# Helper website, www.csharphelper.com. Stay up-to-date and improve your programming skills with this invaluable resource.

Rod Stephens: author's other books


Who wrote C# 5.0 Programmers Reference? Find out the surname, the name of the author of the book and a list of all author's works by series.

C# 5.0 Programmers Reference — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "C# 5.0 Programmers Reference" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Part I The C Ecosystem The C Environment Writing a First Program - photo 1
Part I
The C# Ecosystem
  • : The C# Environment
  • : Writing a First Program
  • : Program and Code File Structure
Chapter 1
The C# Environment

Whats in This Chapter

  • IL and the CLR
  • JIT compiling
  • Programs and assemblies
  • The .NET Framework

Wrox.com Downloads for This Chapter

Please note that all the code examples for this chapter are available as a part of this chapters code download on the books website at www.wrox.com/go/csharp5programmersref on the Download Code tab.

A C# program cannot exist in isolation. You cant write C# programs without using other tools. You cant even run a compiled C# program without libraries that provide runtime support.

This chapter describes the tools that you need in the Windows environment to write, compile, and execute C# programs. Most of the time those tools work smoothly behind the scenes, so you dont need to be aware of their presence. Its still worth knowing what they are, however, so you know how all the pieces of the C# environment fit together.

Visual Studio

You can write a C# program in a text editor and then use a command-line interface to compile the program. (For example, see Working with the C# 2.0 Command Line Compiler at http://msdn.microsoft.com/library/ms379563.aspx for more information.)

That approach is a lot of work, however, so most C# programmers use Visual Studio.

Visual Studio is a powerful integrated development environment ( IDE ) that includes code editors, form and window designers, and flexible debugging tools. Some versions also include testing, profiling, team programming, and other tools.

The Visual Studio code editors provide IntelliSense help, which displays prompts and descriptions of items you need to enter into the code. The code editors features such as IntelliSense make writing correct C# programs much easier than it is with a simple text editor.

If you havent already installed Visual Studio, you should probably do it now. It takes a while, so be sure you have a fast Internet connection.

To learn about and download one of the Visual Studio Express Editions, go to www.visualstudio.com/products/visual-studio-express-vs.

To learn about the other Visual Studio editions, go to www.microsoft.com/visualstudio/eng/products/compare.

While Visual Studio is downloading and installing, you can read further.

The most important tool integrated into Visual Studio is the compiler, which turns C# code into a compiled executable programwell, sort of.

The C# Compiler

The C# compiler doesnt actually compile code into a truly executable program. Instead it translates your C# code into an assembly-like language called Intermediate Language ( IL ).


Whats in a Name?

While under development, the intermediate language was called Microsoft Intermediate Language (MSIL). When .NET was released, the name was changed to IL.

The international standards organization Ecma created the Common Language Infrastructure (CLI) standard that defines a Common Intermediate Language (CIL).

To summarize the alphabet soup, MSIL is the old name for Microsofts intermediate language; IL is the current name; and CIL is the name for the non-Microsoft standard. There are some differences between IL and CIL but many .NET developers use MSIL, IL, and CIL interchangeably.



Programs and Assemblies

The C# compiler doesnt compile only programs; it can also compile other kinds of assemblies. An assembly is the smallest possible piece of compiled code. Assemblies include programs, code libraries, control libraries, and anything else you can compile. An executable program consists of one or more assemblies.


Consider the following C# code.

static void Main(string[] args){ foreach (string arg in args) Console.WriteLine(arg); Console.WriteLine("Press Enter to continue"); Console.ReadLine();}

The C# compiler translates this into the following IL code.

.method private hidebysig static void Main(string[] args) cil managed{ .entrypoint // Code size 51 (0x33) .maxstack 2 .locals init ([0] string arg, [1] string[] CS$6$0000, [2] int32 CS$7$0001, [3] bool CS$4$0002) IL_0000: nop IL_0001: nop IL_0002: ldarg.0 IL_0003: stloc.1 IL_0004: ldc.i4.0 IL_0005: stloc.2 IL_0006: br.s IL_0017 IL_0008: ldloc.1 IL_0009: ldloc.2 IL_000a: ldelem.ref IL_000b: stloc.0 IL_000c: ldloc.0 IL_000d: call void [mscorlib]System.Console::WriteLine(string) IL_0012: nop IL_0013: ldloc.2 IL_0014: ldc.i4.1 IL_0015: add IL_0016: stloc.2 IL_0017: ldloc.2 IL_0018: ldloc.1 IL_0019: ldlen IL_001a: conv.i4 IL_001b: clt IL_001d: stloc.3 IL_001e: ldloc.3 IL_001f: brtrue.s IL_0008 IL_0021: ldstr "Press Enter to continue" IL_0026: call void [mscorlib]System.Console::WriteLine(string) IL_002b: nop IL_002c: call string [mscorlib]System.Console::ReadLine() IL_0031: pop IL_0032: ret} // end of method Program::Main

Displaying IL

You can use the ildasm program to view a compiled programs IL code. (Ildasm is pronounced eye-ell-dazm so it rhymes with chasm. The name stands for IL disassembler.) For information about ildasm, see http://msdn.microsoft.com/library/f7dy01k1.aspx.


The IL code is fairly cryptic; although, if you look closely you can see the methods declaration and calls to Console.WriteLine and Console.ReadLine.

IL code looks a lot like assembly language but its not. Assembly language is a (barely) human-readable version of machine code that can run on a specific kind of computer. If the program were translated into assembly or machine code, it could run only on one kind of computer. That would make sharing the program on different computers difficult.

To make sharing programs on multiple computers easier, IL provides another layer between C# code and machine code. Its like a virtual assembly language that still needs to be compiled into executable machine code. You can copy the IL code onto different computers and then use another compiler to convert it into machine code at run time. In .NET, the Common Language Runtime ( CLR ) performs that compilation.

The CLR

CLR is a virtual machine component of the .NET Framework that translates IL into native machine code when you run a C# program. When you double-click a C# programs compiled executable program, the CLR translates the IL code into machine code that can be executed on the computer.

The CLR uses a just-in-time compiler ( JIT compiler ) to compile pieces of the IL code only when they are needed. When the program is loaded, the loader creates a stub for each method. Initially, that stub points to the methods IL code.

When the program invokes the method, the JIT compiler translates its IL code into machine code, makes the stub point to it, and then runs the machine code. If the program calls the method again later, its stub already points to the machine code, so the method doesnt need to be compiled again.

shows the process graphically.

Usually, the time needed to compile a method is small, so you dont notice the tiny bits of extra time used as each method is called for the first time. After a method is compiled, it runs a tiny bit faster when it is called later.

If a method is never called by the program, it is never compiled by the JIT compiler, so the compiler saves some time.

Compilers translate C code and code in other languages into IL code At run - photo 2Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «C# 5.0 Programmers Reference»

Look at similar books to C# 5.0 Programmers Reference. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «C# 5.0 Programmers Reference»

Discussion, reviews of the book C# 5.0 Programmers Reference and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.