C# 7 provides a very powerful feature from the performance standpoint. This feature is returning by ref. Essentially this allows for value types to be returned without having to copy them. The guidelines are normally that you shouldn’t use a struct with too many fields. Various sources quote various size guidelines. Whenever the struct was over the prescribed size it was recommended that you pass it by reference. With the new syntax for… Read More

Just to reiterate – What are the value types (structs, enums) Value types are cut-down classes.  Imagine classes that don’t support inheritance or finalizers, and you have the cut-down version: the struct.  Structs are defined in the same way as classes (except with the struct keyword), and apart from the some limitations (described below) , structs can have the same rich members, including fields, methods, properties and operators.   In the previous post I have also outlined… Read More