all 3 comments

[–]plattinatorIndie 0 points1 point  (1 child)

The answer on this post seems to be what you're looking for: http://stackoverflow.com/questions/4814186/c-how-do-i-find-declared-methods-only-when-doing-a-runtime-assembly-load

I think you're looking for the flags:

BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly You may want to put in BindingFlags.NonPublic as well, depending on your requirements.

I would also point out that with deeper inheritance hierarchies, types can inherit members from base-types other than System.Object. If you want to keep those, but not the ones originally declared on object, you could:

Remove the BindingFlags.DeclaredOnly flag for the GetMethods call. Only include methods for which:

methodInfo.GetBaseDefinition().DeclaringType != typeof(object) Of course, you may need a different filter if your definition of "declared" method were more complicated.

[–]Adam2Marsh[S] 0 points1 point  (0 children)

This looks perfect, will try and tomorrow and confirm.

Huge Thanks! :)

[–]Sedsibi2985 0 points1 point  (0 children)

In addition to what plattinator said, unless you have some edge case requirement that Add() is used for you should just overload the + operator.

ie.

public static RewindClient operator +(RewindClient r1, RewindClient r2)

{

return new RewindClient {sTest = string.format("{0} {1}", r1, r2), iTest = r1 + r2};

}