|
1
|
|
|
2
|
|
|
3
|
- Common Intermediate Language
|
|
4
|
- Virtual Execution System
- interpreting Common Intermediate Language, CIL
- loading managed code including resolving names
- conversion of CIL into native code
- verification of the type safety of the CIL
- verification of integrity of the metadata
- garbage collection services
- initiation, propagation, and intercepting exceptions
- profiling and debugging services
- management of threads, contexts, and remoting
|
|
5
|
- Common Language Infrastructure
- http://www.ecma.ch/ecma1/STAND/ecma-335.pdf
- submitted by Microsoft, Intel, Hewlett-Packard
- C# complements the CLI
- Partition 1 – CLI foundation
- Common Language Spec (CLS),
Common Type System (CTS),
Virtual Execution System (VES)
- Partition 2 - Metadata
- Assemblies, manifests, modules
Types and Signatures
PE file format
- Partition 3 – CIL instruction set
- Base instructions
Object Model instructions
- Partition 4 – Profiles and Libraries
- kernel profiles, compact profiles, standard libraries
- Partition 5 - Annexes
- sample programs, class library design guidelines, portability
considerations
|
|
6
|
|
|
7
|
- C# has a sensibly limited “preprocessor”
- no #include, no #pragma
- #define, but no macros
|
|
8
|
- C# programs are constructed from tokens
|
|
9
|
- there are 5 kinds of tokens in C# programs
|
|
10
|
- rules
- made of letters and digits
- must start with a letter
- case sensitive
- recommendations
- follow case guidelines
- don't abbreviate
- don't use hungarian
|
|
11
|
- some identifiers have a fixed meaning
|
|
12
|
|
|
13
|
- some tokens group or separate other tokens
- { and } form blocks of statements
- semi- colons mark the end of a simple statement
|
|
14
|
- declarations introduce variables into a block
- a variable has an identifier and a type
- a variable's type can never change
|
|
15
|
- expressions compute things!
- an expression yields a value
- an expression must also have a side- effect
- a variable can't be used until Definitely Assigned
|
|
16
|
- some tokens represent values
|
|
17
|
- some tokens represent actions
|
|
18
|
- layout tokens to reflect grammatical structure
- be consistent and conventional
- here is my personal layout style
- one space on either side of a binary operator
- one space after a comma but not before
- one space after each keyword
- each statement on a separate line
- four spaces per indent
- no space before a semi colon
- no spaces around method call parentheses
- no space between a unary operator and its operand
|
|
19
|
|
|
20
|
|