// This method copies a T reference to a T value via pointer
static unsafe void Copy<T>(ref T src, T* dest) where T : unmanaged => *dest = src;
static unsafe void Test() {
int dest = 0;
int src = 3;
Copy(ref src, &dest);
Console.WriteLine(dest); // Prints '3'
}