But now you are assuming all plugins are called Plugin (actually you are only loading one at most), and that all of those classes contain a method called SampleMethod, and that it returns a String. How can you be sure? Without the Plugin class implementing an interface you can't really be sure unless you check all that.
You could check if the class contained all the methods you need by just keeping a list of their names and checking them... For example:
vb.net Code:
Private _PluginMethods As New List(Of String)
Public Sub New()
_PluginMethods.Add("SampleMethod")
_PluginMethods.Add("AnotherMethod")
_PluginMethods.Add("Start")
End Sub
Private Function IsValidPlugin(ByVal t As Type) As Boolean
For Each method As String In _PluginMethods
If t.GetMethod(method) Is Nothing Then Return False
Next
Return True
End Function
This way you could run the IsValidPlugin method against each type you get, and if it returns True at least you know it has all the methods. You still don't know whether the types they return (if any) are correct (I'm not sure if you can check that at all without invoking them, and I wouldn't invoke them just to check it!) or whether the class was intended as a plugin at all. Someone could have a class which just happens to have all the methods with the same name, possibly with a completely different meaning. Not likely if there's loads of methods in your plugin, but plugins often have only a couple of methods...
Of course you can just 'require' that all plugins are in some destined folder, or something, and if someone puts a non-plugin class in that folder things may go wrong. But I still don't see why a simple DLL isn't an option for you. It solves all these problems by simply providing one interface.
EDIT
On an unrelated note, if you have the Type already (t), you can much more easily use Activator.CreateInstance instead of CreateInstanceFrom and then supply the name of the plugin as a string (again). You'd get an Object in return so your code would look like this
Code:
' Create an instance of this type using Activator class:
Dim i As Object = Activator.CreateInstance(t)
' Get the method info from loaded type:
Dim mi As MethodInfo = t.GetMethod("SampleMethod")
' Invoke it agains the created instance. Note that first you need to unwrap it:
Dim ret As String = mi.Invoke(i, Nothing).ToString