P
puzzlecracker
Say I pass an object of a class (reference value I suppose) to a
method, and I want to pass it by reference. Do I need to preappend
it with ref.
public interface IFoo{}
public class Foo:IFoo{
}
void FromHere()
{
Foo f=new Foo();
Here(ref f);
}
void Here(ref IFoo f )
{
//do something with f
}
Is ref redundant or error-prone. In my scenerio I have a lot of
overload for Here-like function,
and compiler screams that it cannot convert IFoo to char (latter
beeing void Here(ref char c) )
Thanks
method, and I want to pass it by reference. Do I need to preappend
it with ref.
public interface IFoo{}
public class Foo:IFoo{
}
void FromHere()
{
Foo f=new Foo();
Here(ref f);
}
void Here(ref IFoo f )
{
//do something with f
}
Is ref redundant or error-prone. In my scenerio I have a lot of
overload for Here-like function,
and compiler screams that it cannot convert IFoo to char (latter
beeing void Here(ref char c) )
Thanks