C# 4.0 Pocket Reference (Pocket Reference (O'Reilly))

C# 4.0 Pocket Reference (Pocket Reference (O'Reilly))

Joseph Albahari

Language: English

Pages: 218

ISBN: 1449394019

Format: PDF / Kindle (mobi) / ePub


When you're programming C# 4.0 and need a little help, this tightly focused and practical book tells you exactly what you need to know -- without long introductions or bloated examples. It's ideal as a succinct quick reference or as a guide to get you rapidly up to speed if you already know Java, C++, or an earlier version of C#.

Written by the authors of the acclaimed C# 4.0 in a Nutshell (O’Reilly), this book covers the entire C# 4.0 language -- without skimping on the details -- including:

  • Features new to C# 4.0, such as dynamic binding, optional and named parameters, and type parameter variance
  • All of C#'s fundamentals
  • Advanced topics, including operator overloading, custom conversions, type constraints, covariance and contravariance, lambda expressions and closures, iterators, nullable types, and operator lifting
  • LINQ, starting with sequences, lazy execution, and standard query operators; finishing with a complete reference to query expressions
  • Unsafe code and pointers, custom attributes, preprocessor directives, and XML documentation

Laptops Simplified (2nd Edition)

Programming Distributed Computing Systems: A Foundational Approach

Classic Shell Scripting

Beginning iOS 9 Programming with Swift

Building Research Tools with Google For Dummies

 

 

 

 

 

 

 

 

 

 

 

 

 

 

707-829-0515 (international or local) 707-829-0104 (fax) We have a web page for this book, where we list errata, examples, and additional information. You can access this page at: http://oreilly.com/catalog/0636920013365/ 2 | C# 4.0 Pocket Reference Download from Library of Wow! eBook To comment or ask technical questions about this book, send email to: bookquestions@oreilly.com For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see.

Exception thrown This is useful when you’re going to subsequently test whether the result is null: 72 | C# 4.0 Pocket Reference Download from Library of Wow! eBook if (s != null) Console.WriteLine (s.SharesOwned); The as operator cannot perform custom conversions (see “Operator Overloading” on page 135) and it cannot do numeric conversions. The is operator The is operator tests whether a reference conversion would succeed; in other words, whether an object derives from a.

Binding. By design, language runtime binding behaves as similarly as possible to static binding, had the runtime types of the dynamic objects been known at compile time. In our previous example, the behavior of our program would be identical if we hardcoded Mean to work with the int type. The most notable exception in parity between static and dynamic binding is for extension methods, which we discuss in the section “Uncallable Functions” on page 172. 168 | C# 4.0 Pocket Reference Download from.

This like a compile-time error at runtime: dynamic d = 5; d.Hello(); // throws RuntimeBinderException The exception is thrown because the int type has no Hello method. Runtime Representation of dynamic There is a deep equivalence between the dynamic and object types. The runtime treats the following expression as true: typeof (dynamic) == typeof (object) This principle extends to constructed types and array types: typeof (List) == typeof (List) typeof (dynamic[]) == typeof.

Members via an interface, the additional type is communicated via an implicit or explicit cast. (With explicit implementation, it’s in fact impossible to call a member without casting to the interface.) A similar situation arises when calling a hidden base member: you must specify an additional type via either a cast or the base keyword—and that additional type is lost at runtime. Attributes You’re already familiar with the notion of attributing code elements of a program with modifiers, such as.

Download sample

Download