Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to find out what type an object is? - C#

$
0
0

1. I have a function that has one formal parameter (an object) (e.g. ' void abcd (object ob) ' 

2. When I call the function abcd, the object could be anything (e.g. a button, a pictureBox, a panel, etc.)

3. Question: How can I find out what kind of object (the object form the actual parameters of my function) is?

E.g.:

void abcd(object ob)
{
 /// code ///
}

private void button1_Click(object sender, EventArgs e)
{
   abcd(pictureBox1); // or 'abcd(panel1);' or 'abcd(button3);' or etc. 
}

Please help!!!


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>