C
C#3y ago
Carsillas

out ref local?

Seems I am able to do this:
ref int Test1(){
return ref ints[1];
}
ref int Test1(){
return ref ints[1];
}
but not this:
void Test2(out ref int a){
a = ref ints[1];
}
void Test2(out ref int a){
a = ref ints[1];
}
is there some syntax im missing or is this just not possible?
9 Replies
dancepanda42
dancepanda423y ago
you can only have one modifier.
Carsillas
CarsillasOP3y ago
Yeah I realize that the syntax is illegal, im asking if this is possible some other way. Not sure why it would be allowed to return a ref but not out a ref I guess
dancepanda42
dancepanda423y ago
for what at all? I could not think of any sensible reason for this.
Carsillas
CarsillasOP3y ago
🧐 its no less sensible than returning a ref, do you see no reason for ever returning a ref? or specifically no sensible reason for outing one?
dancepanda42
dancepanda423y ago
to declare a ref as out.
Carsillas
CarsillasOP3y ago
Have you used ref locals before? I can't tell if you just dont understand the question or if you just think its a bad idea
dancepanda42
dancepanda423y ago
i just think it's a bad idea.
ero
ero3y ago
out ref is being worked on And by worked on i mean it's in discussion
Carsillas
CarsillasOP3y ago
Nice! was hoping someone else would comment haha, closing the topic now, thanks!
Want results from more Discord servers?
Add your server