Notes
Slide Show
Outline
1
Overview
2
Hello Universe
3
CIL
  • Common Intermediate Language
4
VES
  • 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
CLI
  • 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
C# Features
7
Pre-processing
  • C# has a sensibly limited “preprocessor”
    • no #include, no #pragma
    • #define, but no macros
8
Forty Two
  • C# programs are constructed from tokens
9
Tokens
  • there are 5 kinds of tokens in C# programs
10
Identifiers
  • 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
Keywords
  • some identifiers have a fixed meaning
12
Keyword Table
  • 76 keywords
13
Punctuators
  • some tokens group or separate other tokens
    • { and } form blocks of statements
    • semi- colons mark the end of a simple statement
14
Declarations
  • declarations introduce variables into a block
    • a variable has an identifier and a type
    • a variable's type can never change
15
Expressions
  • 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
Literals
  • some tokens represent values
17
Operators
  • some tokens represent actions
18
Layout
  • 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
Bugs!
20
Blatant Advert