N
newcomer2k
Hi,
I understand how to use the "is" keyword straight forward.
like: if (obj is MyClass1)
However, I would like to parametize the "is"'s argument. Basically, I
would to replace MyClass1 with an argument. Here is an example:
private void foo(WhatType arg)
{
foreach (Control uc in _displayPanel.Controls)
{
if (uc is arg)
uc.Visible = true;
else
uc.Visible = false;
}
}
And call foo like...
foo(MyClass1);
My trouble is, I don't know what is the "arg"'s type? i.e. what
should "WhatType" be?
Is this is even possible?
Thanks for any pointer.
Minh (MCP)
I understand how to use the "is" keyword straight forward.
like: if (obj is MyClass1)
However, I would like to parametize the "is"'s argument. Basically, I
would to replace MyClass1 with an argument. Here is an example:
private void foo(WhatType arg)
{
foreach (Control uc in _displayPanel.Controls)
{
if (uc is arg)
uc.Visible = true;
else
uc.Visible = false;
}
}
And call foo like...
foo(MyClass1);
My trouble is, I don't know what is the "arg"'s type? i.e. what
should "WhatType" be?
Is this is even possible?
Thanks for any pointer.
Minh (MCP)