Skip to content

Ref return C# 7.0performance


Ref returns allow a method to return a reference to another variable rather than a new copy.

WARNING

Using ref can lead to unexpected side effects and code that is hard to follow and debug. It should be used sparingly when measured performance requirements and gains require that trade-off.

Code

Notes

DANGER

Using ref can lead to unexpected side effects and hard to follow and debug code. It should be used sparingly when performance requires it.

More information