Last active
April 27, 2022 16:17
-
-
Save ForNeVeR/a0da2ffc4fd569c5d5e24ed19493321c to your computer and use it in GitHub Desktop.
Revisions
-
ForNeVeR renamed this gist
Apr 27, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ForNeVeR created this gist
Oct 15, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ using System; using System.Reflection; public interface ITest { void TestFun(int arg); } public class TestClass : ITest { void ITest.TestFun(int a) { Console.WriteLine("xxx"); } } class Program { public static void Main(string[] args) { InterfaceMapping interfaceMap = typeof(TestClass).GetInterfaceMap(typeof(ITest)); MethodInfo methodInfo = interfaceMap.TargetMethods[0]; MethodInfo methodInfo2 = interfaceMap.InterfaceMethods[0]; Console.WriteLine(methodInfo.Name); // ITest.TestFun Console.WriteLine(methodInfo2.Name); // TestFun } }