How to determine if an object has a certain method

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

Is it possible to determine if an object has a certain method or property
available? For example, say I have a function with one parameter of type
Object. At the end of the function I want to properly clean up the object
passed to me, but I want to know, first, if the object that was passed to me
implements a Dispose method or not. Is there a way to tell?

- Don
 
* "Don said:
Is it possible to determine if an object has a certain method or property
available? For example, say I have a function with one parameter of type
Object. At the end of the function I want to properly clean up the object

\\\
Dim f As Form1 = Me
.... = f.GetType().GetMethod(...)
///
passed to me, but I want to know, first, if the object that was passed to me
implements a Dispose method or not. Is there a way to tell?

\\\
If TypeOf x Is IDisposable Then
...
End If
///
 
Back
Top