G
Guest
I have created a simple DLL that contains this code:
using System;
namespace Test2
{
public class Test
{
int intAmount = 100;
public int GetValue()
{
return intAmount;
}
}
}
When I want to dynamically reference this DLL and return its value, how do I
accomplish this?
I was doing this:
string sDLLName = "C:\\Test\\Test2.dll";
Assembly objAssembly = System.Reflection.Assembly.LoadFrom(sDLLName);
MethodInfo Method = objAssembly.GetTypes()[0].GetMethod("GetValue");
This code seems to function fine to this point, but any attempts to try to
"invoke" or retrieve the value from the DLL fail miserably. (I am leaving all
of that code out; it is all green anyway It may be something simple, but I
am missing the "zen" of this completely. Any help would be appreciated. Once
I have the method, what is my next step?
Thanks!
Mo
using System;
namespace Test2
{
public class Test
{
int intAmount = 100;
public int GetValue()
{
return intAmount;
}
}
}
When I want to dynamically reference this DLL and return its value, how do I
accomplish this?
I was doing this:
string sDLLName = "C:\\Test\\Test2.dll";
Assembly objAssembly = System.Reflection.Assembly.LoadFrom(sDLLName);
MethodInfo Method = objAssembly.GetTypes()[0].GetMethod("GetValue");
This code seems to function fine to this point, but any attempts to try to
"invoke" or retrieve the value from the DLL fail miserably. (I am leaving all
of that code out; it is all green anyway It may be something simple, but I
am missing the "zen" of this completely. Any help would be appreciated. Once
I have the method, what is my next step?
Thanks!
Mo