Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
C# 4.0 Pocket Reference
SPECIAL OFFER: Upgrade this ebook with O’Reilly
1. C# 4.0 Pocket Reference
Using Code Examples
How to Contact Us
Safari® Books Online
A First C# Program
Compilation
Syntax
Identifiers and Keywords
Avoiding conflicts
Contextual keywords
Literals, Punctuators, and Operators
Comments
Type Basics
Predefined Type Examples
Custom Type Examples
Members of a type
Symmetry of predefined types and custom types
Constructors and instantiation
Instance versus static members
The public keyword
Conversions
Value Types Versus Reference Types
Value types
Reference types
Null
Predefined Type Taxonomy
Numeric Types
Numeric Literals
Numeric literal type inference
Numeric suffixes
Numeric Conversions
Integral to integral conversions
Real to real conversions
Real to integral conversions
Arithmetic Operators
Increment and Decrement Operators
Specialized Integral Operations
Integral division
Integral overflow
The checked and unchecked operators
Bitwise operators
8- and 16-Bit Integrals
Special Float and Double Values
double Versus decimal
Real Number Rounding Errors
Boolean Type and Operators
Equality and Comparison Operators
Conditional Operators
Strings and Characters
String Type
String concatenation
String comparisons
Searching within strings
Manipulating strings
Arrays
Default Element Initialization
Multidimensional Arrays
Rectangular arrays
Jagged arrays
Simplified Array Initialization Expressions
Variables and Parameters
The Stack and the Heap
Stack
Heap
Definite Assignment
Default Values
Parameters
Passing arguments by value
The ref modifier
The out modifier
The params modifier
Optional parameters (C# 4.0)
Named arguments (C# 4.0)
var—Implicitly Typed Local Variables
Expressions and Operators
Assignment Expressions
Operator Precedence and Associativity
Precedence
Left-associative operators
Right-associative operators
Operator Table
Statements
Declaration Statements
Local variable scope
Expression Statements
Selection Statements
The if statement
The else clause
Changing the flow of execution with braces
The switch statement
Iteration Statements
while and do-while loops
for loops
foreach loops
Jump Statements
The break statement
The continue statement
The goto statement
The return statement
Namespaces
The using Directive
Rules Within a Namespace
Name scoping
Name hiding
Repeated namespaces
The global:: qualifier
Aliasing Types and Namespaces
Classes
Fields
Methods
Overloading methods
Instance Constructors
Implicit parameterless constructors
Nonpublic constructors
Object Initializers
The this Reference
Properties
Automatic properties
get and set accessibility
Indexers
Implementing an indexer
Constants
Static Constructors
Static Classes
Finalizers
Partial Types and Methods
Partial methods
Inheritance
Polymorphism
Casting and Reference Conversions
Upcasting
Downcasting
The as operator
The is operator
Virtual Function Members
Abstract Classes and Abstract Members
Hiding Inherited Members
Sealing Functions and Classes
The base Keyword
Constructors and Inheritance
Constructor and field initialization order
Overloading and Resolution
The object Type
Boxing and Unboxing
Static and Runtime Type Checking
The GetType Method and typeof Operator
Object Member Listing
Equals, ReferenceEquals, and GetHashCode
The ToString Method
Structs
Struct Construction Semantics
Access Modifiers
Friend Assemblies
Accessibility Capping
Interfaces
Extending an Interface
Explicit Interface Implementation
Implementing Interface Members Virtually
Reimplementing an Interface in a Subclass
Enums
Enum Conversions
Flags Enums
Enum Operators
Nested Types
Generics
Generic Types
Generic Methods
Declaring Type Parameters
typeof and Unbound Generic Types
The default Generic Value
Generic Constraints
Subclassing Generic Types
Self-Referencing Generic Declarations
Static Data
Covariance (C# 4.0)
Contravariance (C# 4.0)
Delegates
Writing Plug-in Methods with Delegates
Multicast Delegates
Instance Versus Static Method Targets
Generic Delegate Types
The Func and Action Delegates
Delegate Compatibility
Return type variance
Parameter variance
Type parameter variance for generic delegates (C# 4.0)
Events
Standard Event Pattern
Event Accessors
Lambda Expressions
Capturing Outer Variables
Capturing iteration variables
Anonymous Methods
try Statements and Exceptions
The catch Clause
The finally Block
The using statement
Throwing Exceptions
Rethrowing an exception
Key Properties of System.Exception
Common Exception Types
Enumeration and Iterators
Enumeration
Collection Initializers
Iterators
Iterator Semantics
Multiple yield statements
yield break
Composing Sequences
Nullable Types
Nullable Basics
Nullable<T> struct
Implicit and explicit nullable conversions
Boxing and unboxing nullable values
Operator Lifting
Equality operators (== and !=)
Relational operators (<, <=, >=, >)
All other operators (+, −, *, /, %, &, |, ^, <<, >>, +, ++, --, !, ~)
Mixing nullable and nonnullable operators
bool? with & and | Operators
Null Coalescing Operator
Operator Overloading
Operator Functions
Overloading Equality and Comparison Operators
Custom Implicit and Explicit Conversions
Extension Methods
Extension Method Chaining
Ambiguity and Resolution
Namespaces
Extension methods versus instance methods
Extension methods versus extension methods
Anonymous Types
LINQ
LINQ Fundamentals
A simple query
Projecting
Take and Skip
Element operators
Aggregation operators
Quantifiers
Set operators
Deferred Execution
Standard Query Operators
Chaining Query Operators
Query Expressions
Query expressions versus fluent queries
The let Keyword
Query Continuations
Multiple Generators
Joining
GroupJoin
Ordering
Grouping
OfType and Cast
Dynamic Binding (C# 4.0)
Static Binding Versus Dynamic Binding
Custom Binding
Language Binding
RuntimeBinderException
Runtime Representation of dynamic
Dynamic Conversions
var Versus dynamic
Dynamic Expressions
Dynamic Member Overload Resolution
Uncallable Functions
Attributes
Attribute Classes
Named and Positional Attribute Parameters
Attribute Targets
Specifying Multiple Attributes
Writing Custom Attributes
Retrieving Attributes at Runtime
Unsafe Code and Pointers
Pointer Basics
Unsafe Code
The fixed Statement
The Pointer-to-Member Operator
Arrays
The stackalloc keyword
Fixed-size buffers
void*
Pointers to Unmanaged Code
Preprocessor Directives
Pragma Warning
XML Documentation
Standard XML Documentation Tags
Index
About the Authors
SPECIAL OFFER: Upgrade this ebook with O’Reilly
← Prev
Back
Next →
← Prev
Back
Next →