How can I reuse "type alias" in another project?

237 Views Asked by At

I have a project with some interfaces that contains some type alias in it, for example like below:

namespace UsingTest
{
    using MyType = System.Collections.Generic.List<int>;

    public interface IUsingTest
    {
        MyType GetList();
    }
}

How can I use MyType in another project like below? (without need to redefine type alias)

namespace UsingTest
{
    public class UsingClass : IUsingTest
    {
        public MyType GetList()
        {
            throw new NotImplementedException();
        }
    }
}

Note: if I want write the above code in the same project, as you can see in How do I alias a class name in C#, without having to add a line of code to every file that uses the class?, I need just declare MyType as global using in the interface file. But this technique does not work between multiple projects.

0

There are 0 best solutions below