Вы находитесь на странице: 1из 1056

Beijing Cambridge Farnham Kln Sebastopol Taipei Tokyo

8 bits

27 to 271

16 bits

215 to 2151

32 bits

231 to 2311

64 bits

263 to 2631

8 bits

0 to 281

16 bits

0 to 2161

32 bits

0 to 2321

64 bits

0 to 2641

32 bits

(~1045 to 1038)

64 bits

(~10324 to 10308)

128 bits

(~1028 to 1028)

or

Combinable with
or

Combinable with

Complement
And
Or
Exclusive Or
Shift left
Shift right

NaN
+

Internal representation

Base 2

Base 10

Precision

1516 significant figures

2829 significant figures

Range

(~10324 to ~10308)

(~1028 to ~1028)

Special values

+0, 0, +, , and NaN

None

Speed

Native to processor

Non-native to processor (about 10 times slower than


)

Single quote
Double quote
Backslash
Null
Alert
Backspace
Form feed
New line
Carriage return
Horizontal tab
Vertical tab

All reference types


All numeric and enum types
type
type

Value

Going in

Reference

Going in

Reference

Going out

Primary

Grouping

No

Member access

No

Unary

Multiplicative

Additive
Shift
Relational

Pointer to struct (unsafe)

No

Function call

No

Array/index

Via indexer

Post-increment

Yes

Post-decrement

Yes

Create instance

No

Unsafe stack allocation

No

Get type from identifier

No

Integral overflow
check on

No

Integral overflow
check off

No

Get size of struct

No

Positive value of

Yes

Negative value of

Yes

Not

Yes

Bitwise complement

Yes

Pre-increment

Yes

Pre-decrement

Yes

Cast

No

Value at address (unsafe)

No

Address of value (unsafe)

No

Multiply

Yes

Divide

Yes

Remainder

Yes

Add

Yes

Subtract

Yes

Shift left

Yes

Shift right

Yes

Less than

Yes

Greater than

Yes

Less than or equal to

Yes

Equality

Greater than or equal


to

Yes

Type is or is subclass of

No

Type conversion

No

Equals

Yes

Not equals

Yes

Logical And

And

Yes

Logical Xor

Exclusive Or

Yes

Logical Or

Or

Yes

Conditional And

Conditional And

Via

Conditional Or

Conditional Or

Via

Null coalescing

Null coalescing

No

Conditional

Conditional

No

Assignment

Assign

No

Multiply self by

Via

Divide self by

Via

Add to self

Via

Subtract from self

Via

Shift self left by

Via

Shift self right by

Via

And self by

Via

Exclusive-Or self by

Via

Or self by

Via

Lambda

No

Lambda

Preceding the keyword

Attributes and class modifiers. The non-nested class modifiers are , ,


, , , , and

Following

Generic type parameters, a base class, and interfaces

Within the braces

Class members (these are methods, properties, indexers, events, fields, constructors,
operator functions, nested types, and a finalizer)

Static modifier
Access modifiers
Inheritance modifier
Unsafe code modifier
Read-only modifier
Threading modifier

Static modifier
Access modifiers
Inheritance modifiers
Unmanaged code modifiers

Access modifiers
Unmanaged code modifiers

Static modifier
Access modifiers
Inheritance modifiers
Unmanaged code modifiers

Access modifiers
Inheritance modifier

Unmanaged code modifier

Unsorted
Hashtable

No

22

30

30

20

Hashtable

No

38

50

50

30

Linked list

No

36

50,000

50,000

50,000

Hashtable
+ array

Yes

59

70

70

40

Red/black
tree

No

20

130

100

120

2xArray

Yes

3,300

30

40

2xArray

Yes

27

4,500

100

180

Sorted

Element type for the input sequence


Element type for the output sequenceif different from
Element type for the key used in sorting, grouping, or joining

Gatekeeper class for all CRUD operations


Method to (lazily) retrieve all entities of a given type from the
store
Type returned by the above method
Method to update the store with any additions, modifications,
or deletions to entity objects
Method to add a new entity to the store when the context is
updated
Method to delete an entity from the store when the context is
updated
Type to represent one side of a relationship property, when
that side has a multiplicity of many

Type to represent one side of a relationship property, when


that side has a multiplicity of one
Default strategy for loading relationship properties
Construct that enables eager loading

Lazy

Explicit

Returns a subset of elements that satisfy a given condition


Returns the first elements and discards the rest
or subquery
Ignores the first elements and returns the rest
or
Emits elements from the input sequence until the predicate is
false

Exception thrown

Ignores elements from the input sequence until the predicate


is false, and then emits the rest

Exception thrown

Returns a sequence that excludes duplicates

Source sequence
Predicate
a Prohibited with LINQ to SQL and Entity Framework.

Source sequence
Number of elements to take or skip

Source sequence
Predicate

or

Transforms each input element with the given lambda expression


Transforms each input element, and then flattens and concatenates the
resultant subsequences

Source sequence
Result selector

or

a Prohibited with LINQ to SQL and Entity Framework.

,
,

Source sequence
Result selector
or
a Prohibited with LINQ to SQL

Applies a lookup strategy to match elements from two collections, emitting


a flat result set
As above, but emits a hierarchical result set

Outer sequence
Inner sequence
Outer key selector
Inner key selector
Result selector

Outer sequence
Inner sequence
Outer key selector
Inner key selector
Result selector

Flat

Bad

Yes

Yes

Yes

Yes

Nested

Bad

Yes

Yes

Yes

Yes

Flat

Good

Yes

Nested

Good

Yes

Yes

Flat

Good

Yes

Yes

Sorts a sequence in ascending order

...

Sorts a sequence in descending order

...

Returns a sequence in reverse order

Exception thrown

Input sequence
Key selector

Input sequence
Key selector

Groups a sequence into subsequences

Input sequence
Key selector
Element selector (optional)
Comparer (optional)

Returns a concatenation of elements in each of the two sequences


Returns a concatenation of elements in each of the two sequences,
excluding duplicates
Returns elements present in both sequences
Returns elements present in the first, but not the second sequence
or

Converts to , discarding wrongly typed elements


Converts to , throwing an exception if there are any wrongly
typed elements
Converts to
Converts to
Converts to
Converts to
Downcasts to
Casts or converts to

Input sequence
Key selector
Element selector (optional)
Comparer (optional)

Returns the first element in


the sequence, optionally satisfying a predicate

... ...

Returns the last element in


the sequence, optionally satisfying a predicate

... ...

Equivalent to
, but
throws an exception if there
is more than one match
Returns the element at the
specified position
Returns null or
if
the sequence has no
elements

Source sequence
Predicate (optional)

Exception thrown

Source sequence
Index of element to return

Returns the number of elements in the input sequence,


optionally satisfying a predicate
Returns the smallest or largest element in the sequence
Calculates a numeric sum or average over elements in the
sequence
Performs a custom aggregation

Source sequence
Predicate (optional)

Exception thrown

Source sequence
Result selector (optional)

Source sequence
Result selector (optional)

Returns if the input sequence contains the given element

... ...

Returns if any elements satisfy the given predicate

... ...

Returns if all elements satisfy the given predicate

...

Returns if the second sequence has identical elements to the input


sequence

Creates an empty sequence


Creates a sequence of repeating elements
Creates a sequence of integers

Unsorted
Hashtable

No

22

30

30

20

Hashtable

No

38

50

50

30

Linked list

No

36

50,000

50,000

50,000

Hashtable
+ array

Yes

59

70

70

40

Red/black
tree

No

20

130

100

120

2xArray

Yes

3,300

30

40

2xArray

Yes

27

4,500

100

180

Sorted

Element type for the input sequence


Element type for the output sequenceif different from
Element type for the key used in sorting, grouping, or joining

Gatekeeper class for all CRUD operations


Method to (lazily) retrieve all entities of a given type from the
store
Type returned by the above method
Method to update the store with any additions, modifications,
or deletions to entity objects
Method to add a new entity to the store when the context is
updated
Method to delete an entity from the store when the context is
updated
Type to represent one side of a relationship property, when
that side has a multiplicity of many

Type to represent one side of a relationship property, when


that side has a multiplicity of one
Default strategy for loading relationship properties
Construct that enables eager loading

Lazy

Explicit

Returns a subset of elements that satisfy a given condition


Returns the first elements and discards the rest
or subquery
Ignores the first elements and returns the rest
or
Emits elements from the input sequence until the predicate is
false

Exception thrown

Ignores elements from the input sequence until the predicate


is false, and then emits the rest

Exception thrown

Returns a sequence that excludes duplicates

Source sequence
Predicate
a Prohibited with LINQ to SQL and Entity Framework.

Source sequence
Number of elements to take or skip

Source sequence
Predicate

or

Transforms each input element with the given lambda expression


Transforms each input element, and then flattens and concatenates the
resultant subsequences

Source sequence
Result selector

or

a Prohibited with LINQ to SQL and Entity Framework.

,
,

Source sequence
Result selector
or
a Prohibited with LINQ to SQL

Applies a lookup strategy to match elements from two collections, emitting


a flat result set
As above, but emits a hierarchical result set

Outer sequence
Inner sequence
Outer key selector
Inner key selector
Result selector

Outer sequence
Inner sequence
Outer key selector
Inner key selector
Result selector

Flat

Bad

Yes

Yes

Yes

Yes

Nested

Bad

Yes

Yes

Yes

Yes

Flat

Good

Yes

Nested

Good

Yes

Yes

Flat

Good

Yes

Yes

Sorts a sequence in ascending order

...

Sorts a sequence in descending order

...

Returns a sequence in reverse order

Exception thrown

Input sequence
Key selector

Input sequence
Key selector

Groups a sequence into subsequences

Input sequence
Key selector
Element selector (optional)
Comparer (optional)

Returns a concatenation of elements in each of the two sequences


Returns a concatenation of elements in each of the two sequences,
excluding duplicates
Returns elements present in both sequences
Returns elements present in the first, but not the second sequence
or

Converts to , discarding wrongly typed elements


Converts to , throwing an exception if there are any wrongly
typed elements
Converts to
Converts to
Converts to
Converts to
Downcasts to
Casts or converts to

Input sequence
Key selector
Element selector (optional)
Comparer (optional)

Returns the first element in


the sequence, optionally satisfying a predicate

... ...

Returns the last element in


the sequence, optionally satisfying a predicate

... ...

Equivalent to
, but
throws an exception if there
is more than one match
Returns the element at the
specified position
Returns null or
if
the sequence has no
elements

Source sequence
Predicate (optional)

Exception thrown

Source sequence
Index of element to return

Returns the number of elements in the input sequence,


optionally satisfying a predicate
Returns the smallest or largest element in the sequence
Calculates a numeric sum or average over elements in the
sequence
Performs a custom aggregation

Source sequence
Predicate (optional)

Exception thrown

Source sequence
Result selector (optional)

Source sequence
Result selector (optional)

Returns if the input sequence contains the given element

... ...

Returns if any elements satisfy the given predicate

... ...

Returns if all elements satisfy the given predicate

...

Returns if the second sequence has identical elements to the input


sequence

Creates an empty sequence


Creates a sequence of repeating elements
Creates a sequence of integers

,
,

Add
Remove

Update

See Reading Attributes on page 454

Children
Recursively children
Current node (usually implied)
Parent node
Wildcard
Attribute
Filter
Namespace separator

(LINQ to SQL)

Prevents further I/O

When you later need to read/write the stream

Flushes the reader/writer and


closes the underlying stream

When you want to keep the underlying stream open (you


must instead call on a when
youre done)

Releases a database connection


and clears the connection string

If you need to re- it, you should call instead


of

Prevents further use

When you might have lazily evaluated queries connected


to that context

Reading

Writing

Seeking

Closing/flushing

Timeouts

Other

Reading one char


Reading many
chars

Closing
Other

Writing one char


Writing many chars

Closing and flushing

Formatting and
encoding

Other

chars 0 to 31 and
chars 0 to 31 and
<local user folder>\
<local user folder>\\

Domain User
(default)

Domain
Roaming
Domain
Machine

Assembly User

Assembly
Roaming
Assembly
Machine

Local user

\IsolatedStorage

Roaming user

\IsolatedStorage

Machine

\IsolatedStorage

Local user

\Users\<user>\AppData\Local\IsolatedStorage

Roaming user

\Users\<user>\AppData\Roaming\IsolatedStorage

Machine

\ProgramData\IsolatedStorage

Local user

\Documents and Settings\<user>\Local Settings\Application Data\IsolatedStorage

Roaming user

\Documents and Settings\<user>\Application Data\IsolatedStorage

Machine

\Documents and Settings\All Users\Application Data\IsolatedStorage

DNS

Domain Name Service

Converts between domain names (e.g., ebay.com) and IP addresses


(e.g., 199.54.213.2)

FTP

File Transfer Protocol

Internet-based protocol for sending and receiving files

HTTP

Hypertext Transfer Protocol

Retrieves web pages and runs web services

IIS

Internet Information Services

Microsofts web server software

IP

Internet Protocol

Network-layer protocol below TCP and UDP

LAN

Local Area Network

Most LANs use Internet-based protocols such as TCP/IP

POP

Post Office Protocol

Retrieves Internet mail

SMTP

Simple Mail Transfer Protocol

Sends Internet mail

TCP

Transmission and Control


Protocol

Transport-layer Internet protocol on top of which most higher-layer


services are built

UDP

Universal Datagram Protocol

Transport-layer Internet protocol used for low-overhead services such


as VoIP

UNC

Universal Naming Convention

\\computer\sharename\filename

URI

Uniform Resource Identifier

Ubiquitous resource naming system (e.g., http://www.amazon.com


or mailto:joe@bloggs.org)

URL

Uniform Resource Locator

Technical meaning (fading from use): subset of URI; popular meaning:


synonym of URI

http: or https:
ftp:
file:

Welcome message

Client connects...

Lists the ID and file size of each message on the server

Retrieves the message with the specified ID


Content of message #1...
Deletes a message from the server

Level of automation

***

*****

****

Type coupling

Choice

Tight

Loose

Loose

Version tolerance

*****

***

*****

*****

Preserves object references

Choice

Yes

No

Choice

Can serialize nonpublic fields

Yes

Yes

No

Yes

Suitability for interoperable messaging

*****

**

****

****

Flexibility in reading/writing XML files

**

****

*****

Compact output

**

****

**

**

Performance

***

****

* to ***

***

Returns the fully qualified name or an


object

Assembly Names on page 655

Location of the assembly file

Resolving and Loading Assemblies on page 671

,,

Manually loads an assembly into the


current application domain

Resolving and Loading Assemblies on page 671

Indicates whether the assembly is defined in the GAC

The Global Assembly


Cache on page 661

Locates the satellite assembly of a


given culture

Resources and Satellite Assemblies on page 663

Returns a type, or all types, defined in


the assembly

Reflecting and Activating


Types on page 682

Returns the applications entry


method, as a

Reflecting and Invoking Members on page 688

Returns all modules, or the main module, of an assembly

Reflecting Assemblies
on page 700

Returns the assemblys attributes

Working with Attributes on page 701

Method

Method name

Property

Property name

Indexer

(containing
objects if compiled in C#)

Field

Field name

Enum member

Member name

Event

Event name

Constructor
Finalizer
Operator

+ operator name

Nested type

Type name

Property

and

Indexer

and

Event

and

Method
,

Property or field

Indexer
Unary operator such as
Binary operator such as
Conversion (cast) to another type
Invocation on the object itselfe.g.,

Advanced operations, such as calling unmanaged code


Use of reflection
Reading/writing command-line environment settings
Reading or writing to the Windows Registry

Reading/writing files and directories


Reading/writing to a file chosen through an Open or Save
dialog
Reading/writing to own isolated storage
Reading of application configuration files
,,

Communicating with a database server using the


, , or class
Participation in distributed transactions

DNS lookup
-based network access
-based network access
Sending mail through the SMTP libraries
Use of classes such as and

Use of the Windows data protection methods


Public key encryption and signing
Access to X.509 certificate stores

Creating windows and interacting with the clipboard


Use of the control
Image, audio, and video support in WPF
Accessing a printer

Reading or writing to the Windows event log


Use of Windows performance counters

The assembly is loaded into the GAC


The calling assembly has a particular strong name

The calling assembly is Authenticode-signed with a particular certificate

Fast

Depends on
users password

Protects files transparently with filesystem support. A key is derived implicitly from the logged-in users
credentials.

Windows Data
Protection

Fast

Depends on users
password

Encrypts and decrypts byte arrays using


an implicitly derived key.

Hashing

Fast

High

One-way (irreversible) transformation. Used for storing passwords, comparing files, and checking for data
corruption.

Symmetric Encryption

Fast

High

For general-purpose encryption/decryption. The same key encrypts and


decrypts. Can be used to secure
messages in transit.

Public Key Encryption

Slow

High

Encryption and decryption use different keys. Used for exchanging a symmetric key in message transmission
and for digitally signing files.

Rarely or never blocks any thread

May block threads for any length of time (although not the calling
thread)

method may not return immediately to the


caller

returns immediately to the caller

Ignores case (by default, regular expressions are case-sensitive)


Changes and so that they match the start/end of a line
instead of start/end of the string
Captures only explicitly named or explicitly numbered groups
Forces compilation of regular expression to IL
Makes match every character (instead of matching every
character except )
Eliminates unescaped whitespace from the pattern

Searches from right to left; cant be specified midstream


Forces ECMA compliance (by default, the implementation is not
ECMA-compliant)
Turns off culture-specific behavior (by default,
influences string comparison rules)

Matches a single character in the list


Matches a single character in a range
Matches a decimal digit
Same as
Matches a word character (by default, varies according to
; for example, in English, same as )
Matches a whitespace character
Same as
category

Matches a character in a specified category


(Default mode) Matches any character except
( mode) Matches any character

Zero or more matches


One or more matches
Zero or one match
Exactly matches
At least matches
Between and matches

Bell
Backspace
Tab
Carriage return
Vertical tab
Form feed
Newline
Escape
ASCII character nnn as octal (e.g.,
ASCII character nn as hex (e.g., )
ASCII control character l (e.g., for Ctrl-G)
Unicode character nnnn as hex (e.g., )
A nonescaped symbol

Matches a single character in the list


Matches a single character in a range
Matches a decimal digit
Same as
Matches a word character (by default, varies
according to
; for example, in English, same as
)
Matches a whitespace character
Same as

Matches a character in a specified category (see


Table 26-6)
(Default mode) Matches any character except
( mode) Matches any character

Letters
Uppercase letters
Lowercase letters
Numbers
Punctuation
Diacritic marks
Symbols
Separators
Control characters

Zero or more matches


One or more matches
Zero or one match
Exactly matches
At least matches
Between and matches

Substitutes the matched text


Substitutes an indexed within the matched text
Substitutes a text within the matched text

Start of string (or line in multiline mode)


End of string (or line in multiline mode)
Start of string (ignores multiline mode)
End of string (ignores multiline mode)
End of line or string
Where search started
On a word boundary
Not on a word boundary
Continue matching only if expression matches on right (positive lookahead)
Continue matching only if expression doesnt match on right (negative lookahead)
Continue matching only if expression matches on left (positive lookbehind)
Continue matching only if expression doesnt match on left (negative lookbehind)
Subexpression is matched once and not backtracked

Capture matched expression into indexed group


Capture matched substring into a specified group
Capture matched substring into group
Undefine , and store interval and current group into ; if is undefined,
matching backtracks; is optional
Noncapturing group

Reference a previously captured group by


Reference a previously captured group by

Logical OR
Matches if expression matches; otherwise, matches ( is optional)
Matches if named group has a match; otherwise, matches ( is optional)

Inline comment
Comment to end of line (works only in mode)

Case-insensitive match (ignore case)


Multiline mode; changes and so that they match beginning and end of any line
Captures only explicitly named or numbered groups
Compiles to IL
Single-line mode; changes meaning of . so that it matches every character
Eliminates unescaped whitespace from the pattern
Searches from right to left; cant be specified midstream

Оценить