C# 6.0 in a Nutshell: The Definitive Reference

C# 6.0 in a Nutshell: The Definitive Reference

Language: English

Pages: 1136

ISBN: 1491927062

Format: PDF / Kindle (mobi) / ePub


When you have questions about C# 6.0 or the .NET CLR and its core Framework assemblies, this bestselling guide has the answers you need. C# has become a language of unusual flexibility and breadth since its premiere in 2000, but this continual growth means there’s still much more to learn.

Organized around concepts and use cases, this thoroughly updated sixth edition provides intermediate and advanced programmers with a concise map of C# and .NET knowledge. Dive in and discover why this Nutshell guide is considered the definitive reference on C#.

  • Get up to speed with all aspects of the C# language, from the basics of syntax and variables, to advanced topics such as pointers and operator overloading
  • Dig deep into LINQ via three chapters dedicated to the topic
  • Learn about dynamic, asynchronous, and parallel programming
  • Work with .NET features, including XML, networking, serialization, reflection, security, application domains, and code contracts
  • Explore the new C# 6.0 compiler-as-a-service, Roslyn

Optimizing Java

Pro Android Graphics

Beginning ASP.NET 4.5 in C#

Agile Product Development: How to Design Innovative Products That Create Customer Value

C++ How to Program (7th Edition)

Linux Essentials (2nd Edition)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

and comparison operators, ==, !=, <, >, >=, and <=, work for all numeric types, but should be used with caution with real numbers (as we saw in “RealNumber Rounding Errors” on page 32). The comparison operators also work on enum type members, by comparing their underlying integral values. We describe this in “Enums” on page 109 in Chapter 3. We explain the equality and comparison operators in greater detail in “Operator Overloading” on page 168 in Chapter 4, and in “Equality Comparison” on page

Parameters define the set of arguments that must be provided for that method. In this example, the method Foo has a single parameter named p, of type int: static void Foo (int p) { p = p + 1; 44 | Chapter 2: C# Language Basics // Increment p by 1 Console.WriteLine (p); // Write p to screen } static void Main() { Foo (8); } // Call Foo with an argument of 8 C# Language Basics You can control how parameters are passed with the ref and out modifiers: Parameter modifier Passed by Variable

function members that encapsulate a piece of an object’s state, such as a button’s color or a label’s text. Events are function members that simplify acting on object state changes. While C# is primarily an object-oriented language, it also borrows from the func‐ tional programming paradigm. Specifically: Functions can be treated as values Through the use of delegates, C# allows functions to be passed as values to and from other functions. C# supports patterns for purity Core to functional

enumerable object in a single step. For example: using System.Collections.Generic; ... List list = new List {1, 2, 3}; The compiler translates this to the following: using System.Collections.Generic; ... List list = new List(); list.Add (1); list.Add (2); list.Add (3); Enumeration and Iterators | 157 Advanced C# foreach (char c in "beer") Console.WriteLine (c); This requires that the enumerable object implements the System.Collec tions.IEnumerable interface and that it

suitable: • Write a constructor that has a parameter of the type to convert from. • Write ToXXX and (static) FromXXX methods to convert between types. As explained in the discussion on types, the rationale behind implicit conversions is that they are guaranteed to succeed and not lose information during the conversion. Conversely, an explicit conversion should be required either when runtime circum‐ stances will determine whether the conversion will succeed or if information may be lost during

Download sample

Download

About admin