首页 > 学院 > 开发设计 > 正文

【转载】#273

2019-11-17 03:18:48
字体:
来源:转载
供稿:网友

【转载】#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

原文地址:#273 - Parameter Modifier Summary


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表