"Readonly Ref Returns and Locals"

static Matrix4x4 _viewMat;

static ref readonly Matrix4x4 GetMatrix() => ref _viewMat;

static void Test() {
    ref readonly var mat = ref GetMatrix();
    var matCopy = mat;

    mat.M11 = 3f; // This line won't compile, we can not modify a readonly ref
    matCopy.M11 = 3f; // This line is fine, 'matCopy' is a local stack copy of the variable pointed to by 'mat'
}


Code snippet taken from "Two Decades of C#: A Reference - C# 7".