Advertisement
Timtsa

Interface

Apr 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. extern alias CL1;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using ClassLibrary2;
  7. using TestName = CL1.ClassLibrary1.Class1;
  8. using static System.Console;
  9.  
  10.  
  11. namespace Interface
  12. {
  13.     class Program
  14.     {
  15.  
  16.         public interface IsomeinterfaceA
  17.         {
  18.             void SomeMethod();
  19.         }
  20.  
  21.         public interface IsomeinterfaceB
  22.         {
  23.             void SomeMethod();
  24.         }
  25.  
  26.         public class MyClass : IsomeinterfaceA, IsomeinterfaceB
  27.         {
  28.             void IsomeinterfaceA.SomeMethod()
  29.             {
  30.                 WriteLine("Some Method");
  31.             }
  32.  
  33.              void IsomeinterfaceB.SomeMethod()
  34.             {
  35.                 WriteLine("Some Method B");
  36.             }
  37.  
  38.         }
  39.  
  40.  
  41.        
  42.  
  43.  
  44.        
  45.  
  46.         static void Main(string[] args)
  47.         {
  48.             MyClass myClass = new MyClass();
  49.             IsomeinterfaceA ref1 = myClass;
  50.             IsomeinterfaceB ref2 = myClass;
  51.  
  52.             ref1.SomeMethod();
  53.             ref2.SomeMethod();
  54.            
  55.  
  56.            
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement