Esempio n. 1
0
        /// <summary>
        ///     <para>Метод класса и Интерфейсный метод имеют разные записи в таблице методов</para>
        ///     <para>И указывают на РАЗНЫЕ реализации</para>
        /// </summary>
        private static void Example2()
        {
            var m2 = new MyClass2();

            m2.MyMethod();
            // output: MyClass2 implementation of IMyInterface

            IMyInterface i2 = m2;

            i2.MyMethod();
            // output: MyClass2 EXPLICIT implementation of IMyInterface
        }
Esempio n. 2
0
        /// <summary>
        ///     Метод класса и Интерфейсный метод имеют разные записи в таблице методов, но указывают на одну реализацию
        /// </summary>
        private static void Example1()
        {
            var m1 = new MyClass1();

            m1.MyMethod();
            // output: MyClass1 implementation of IMyInterface

            IMyInterface i1 = m1;

            i1.MyMethod();
            // output: MyClass1 implementation of IMyInterface
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ITypeConfig typeConfig =
                Core.FindOrCreateTypeConfig <IMyInterface, WrapperInterface>("MyGeneratedClass");

            typeConfig.SetMemberMap(nameof(WrapperInterface.TheClass), nameof(MyClass.MyInt), nameof(IMyInterface.TheInt));
            typeConfig.SetMemberMap(nameof(WrapperInterface.TheClass), nameof(MyClass.MyStr), nameof(IMyInterface.TheStr));

            typeConfig.ConfigurationCompleted();

            IMyInterface myInterfaceObj = Core.GetInstanceOfGeneratedType <IMyInterface>(typeConfig.ClassName);

            myInterfaceObj.TheInt = 1234;
            myInterfaceObj.TheStr = "Hello";
            myInterfaceObj.MyMethod("blabla", 123);
        }
Esempio n. 4
0
 public IActionResult GetMyMethodValue()
 {
     ServiceEventSource.Current.ServiceMessage(cxt, "Retrieving MyMethod's value");
     return(Ok(myField.MyMethod()));
 }
Esempio n. 5
0
 static int DoWork <T>(IMyInterface <T> a) => a.MyMethod();