#273 – Parameter Modifier Summary

Here’s a summary of the different parameter modifiers and how the behavior changes for each, when using them with value-typed and reference-typed variables.

  • No modifier – value types
    • Copy of value passed to method
    • Method can read value
  • No modifier – reference types
    • Reference to object passed to method
    • Method can read/write object contents
  • ref modifier – value types
    • Reference to variable passed to method
    • Method can read/write variable
  • ref modifier – reference types
    • Reference to object reference passed to method
    • Method can read/write object contents
    • Method can change reference to point to new object
  • out modifier – value types
    • Reference to variable passed to method
    • Method must write new value to variable
  • out modifier – reference types
    • Reference to object reference passed to method
    • Method must change reference to point to new object
Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: