Afficher une valeur d'une autre classe à l'aide d'une Interface en C# et VB.Net

Comment saisir la variable le la classe A et afficher les valeurs de la classe B sous forme d'une liste à l'aide d'une interface?

VB.Net

01.Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
02.    Dim myVar As String = "Hello Motto ! =)"
03.  
04.    Dim a As ClassA = New ClassA()
05.    Dim message As String = a.Test1(myVar)
06.  
07.    Dim b As ClassB = New ClassB()
08.    Dim output As String = b.Test2(message)
09.  
10.    Response.Write(String.Format("Welcome message from ClassB is <b>{0}</b>", output))
11.End Sub
12.  
13.Public Interface Test
14.    Function Test1(ByVal a As String) As String
15.    Function Test2(ByVal a As String) As String
16.End Interface
17.  
18.Public Class ClassA
19.    Implements Test
20.  
21.    Public Function Test1(ByVal a As String) As String Implements Test.Test1
22.        Return a
23.    End Function
24.  
25.    Public Function Test2(ByVal a As String) As String Implements Test.Test2
26.        Return a
27.    End Function
28.End Class
29.  
30.Public Class ClassB
31.    Implements Test
32.  
33.    Public Function Test1(ByVal a As String) As String Implements Test.Test1
34.        Return a
35.    End Function
36.  
37.    Public Function Test2(ByVal a As String) As String Implements Test.Test2
38.        Return a
39.    End Function
40.End Class

 

C#

01.protected void Page_Load(object sender, EventArgs e)
02.{
03.    string myVar = "Hello World";
04.  
05.    ClassA a = new ClassA();
06.    string message = a.Test1(myVar);
07.  
08.    ClassB b = new ClassB();
09.    string output = b.Test2(message);
10.  
11.    Response.Write(string.Format("Welcome message from Class_B is <b>{0}</b>", output));
12.}
13.  
14.public interface Test
15.{
16.    string Test1(string a);
17.    string Test2(string a);
18.}
19.  
20.public class ClassA : Test
21.{
22.    public string Test1(string a)
23.    {
24.        return a;
25.    }
26.  
27.    public string Test2(string a)
28.    {
29.        return a;
30.    }
31.}
32.  
33.public class ClassB : Test
34.{
35.    public string Test1(string a)
36.    {
37.        return a;
38.    }
39.  
40.    public string Test2(string a)
41.    {
42.        return a;
43.    }
44.}