Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
Cannot initialize a by-reference variable with a value
The following sample generates CS8172:
// CS8172.cs (10,17)
class C
{
void M()
{
ref readonly int L() => ref (new int[1])[0];
ref readonly int x = ref L();
ref int y = x;
}
}
Assigning a reference to a variable to a by-reference variable corrects this error:
class C
{
void M()
{
ref readonly int L() => ref (new int[1])[0];
ref readonly int x = ref L();
ref int y = ref x;
}
}
.NET maklum balas
.NET ialah projek sumber terbuka. Pilih pautan untuk memberikan maklum balas: