Saturday, February 6, 2010

Basic rules for using anonymous types

  • Anonymous types must always have an initial assignment and it can’t be null because the type is inferred and fixed to the initializer.
  • can be used with simple or complex types
  • can be used as initializers in for loops
  • can be used and has to be used for array initializers
  • can be used with arrays
  • can be returned from methods but must be cast to object
  • cannot be used for a class field
Post a Comment