令我感到沮丧的是,随后的法典赢得了汇编。
It will however compile if I remove the ref
keyword.
class xyz
{
static void foo(ref object aaa)
{
}
static void bar()
{
string bbb="";
foo(ref bbb);
//foo(ref (object)bbb); also doesnt work
}
}
Can anyone explain this? Im guessing it has something to do with ref s being very strict with derived classes.
Is there any way I can pass an object of type string to
foo(ref object varname)
?