Reputation: 833
public abstract class DbAttribute : IComparable
{
}
public abstract bool GetString(DbAttribute attributeName, ref string attributeValue);
Assembly testAssembly = null;
Type attributeA = testAssembly.GetType("A.Core.Data.DbAttribute");
Type elementA = testAssembly.GetType("A.Core.Data.DbElement");
MethodInfo mi = elementA.GetMethod("GetString", new Type[] { attributeA, typeof(System.String)});
mi
is null event hough elementA.getMethods()
show me the GetString
method. I think i am doing something wrong with parameter attributeA
.
If I use typeof(System.Object)
instead of attributeA, still it returns null.
Please suggest how to use the GetMethod
properly in this case.
Upvotes: 0
Views: 193
Reputation: 771
I think it caused by ref parameter
MethodInfo mi =ElementA.GetMethod("GetString",new Type[] { typeof(AttributeA) ,typeof(System.String).MakeByRefType()});
Upvotes: 3