-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from koculu/24-feature-add-an-interface-to-cus…
…tomize-retrieving-type-members Add MemberProvider interface.
- Loading branch information
Showing
8 changed files
with
143 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Tenray.Topaz.Interop; | ||
|
||
public interface IMemberInfoProvider | ||
{ | ||
MemberInfo[] GetInstanceMembers(object instance, string memberName); | ||
|
||
MemberInfo[] GetStaticMembers(Type type, string memberName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Tenray.Topaz.Interop; | ||
|
||
public class MemberInfoProvider : IMemberInfoProvider | ||
{ | ||
public MemberInfo[] GetInstanceMembers(object instance, string memberName) | ||
{ | ||
return instance.GetType().GetMember(memberName, BindingFlags.Public | BindingFlags.Instance); | ||
} | ||
|
||
public MemberInfo[] GetStaticMembers(Type type, string memberName) | ||
{ | ||
return type.GetMember(memberName, BindingFlags.Public | BindingFlags.Static); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters