hopefully someone can help me out here. i'm trying to use reflection to invoke the dispose method within a class but it keeps throwing an exception
here's my code
vb Code:
If m_DataSource.GetType.GetInterface("IDisposable") IsNot Nothing Then Dim obj As Type = m_DataSource.GetType.GetInterface("IDisposable") If obj IsNot Nothing Then obj.InvokeMember("Dispose", Reflection.BindingFlags.DeclaredOnly Or Reflection.BindingFlags.Public Or Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.InvokeMethod, Nothing, Nothing, Nothing) End If End If



Reply With Quote