Hi there,
Is it possible to pass null to a function taking an "out" (or "ref")
parameter in C#. I'd like to do something like the following (which doesn't
compile of course). Thanks in advance.
int SomeValue;
Func(null, SomeValue); // Any way to pass null for either arg?
void Func(out int Param1, out int Param2)
{
if (Param1 != null)
{
Param1 = Whatever1();
}
if (Param2 != null)
{
Param2 = Whatever2();
}
}
Is it possible to pass null to a function taking an "out" (or "ref")
parameter in C#. I'd like to do something like the following (which doesn't
compile of course). Thanks in advance.
int SomeValue;
Func(null, SomeValue); // Any way to pass null for either arg?
void Func(out int Param1, out int Param2)
{
if (Param1 != null)
{
Param1 = Whatever1();
}
if (Param2 != null)
{
Param2 = Whatever2();
}
}
Comment