Is it possible to use AutoMapper to map methods?

Posted by Woj on Stack Overflow See other posts from Stack Overflow or by Woj
Published on 2010-04-22T13:31:21Z Indexed on 2010/04/22 13:33 UTC
Read the original article Hit count: 160

Filed under:
|
|
|

I have two classes:

public class TestClass1
{
    public int TestInt { get; set; }

    public void TestMethod()
    {
        // Do something
    }
}

public class TestClass2
{
    public int TestInt { get; set; }

    public void TestMethod()
    {
        // Do something
    }
}

I want to create interface that I can use for both classes. The easiest solution is to implement the interface on TestClass1 and TestClass2 but I don;t have access to the implementation of these classes (external dll). I was wondering if I can create new interface and use AutoMapper to map TestClass1 and TestClass2 to ITestInterface:

public interface ITestInterface
{
    int TestInt { get; set; }

    void TestMethod();
}

© Stack Overflow or respective owner

Related posts about automapper

Related posts about .NET