Skip to main content
ref

ref

2 8.5
A word in code that lets a function change a variable from the code that called it
  • noun
  • /rɛf/
  • Specialized
translation icon : palabra clave ref
  • When passing a large object to a function, using a ref can optimize performance by avoiding unnecessary copying.

Examples

  • The ref keyword in programming helps ensure that changes to a variable within a function persist outside of it.

  • The constructor is initialized with a ref count = 1, but in my assignment operator, I am retaining the object, making the ref count = 2.

    Blog text (18)
  • Once you've mutated your multi value ref, set it back on the person and then save the address book.

  • So this is a function in UI Kit that tells UI Kit to create a new CG context ref that points to a piece of memory that is as big as size.

  • In C#, you must declare a parameter as a ref type to allow the function to modify the original variable.

Synonyms

reference
vsref
  • Specialized
156 5.5

The thing a word or phrase points to

is a programming keyword that lets a function change the caller's variable

Surface Forms

ref singular
refs plural

Etymology

Ref in programming is short for reference, which means 'a way to point to something'. So a ref parameter lets a function point to and change the original variable.