I have a using alias directive to alias a complex type for readability.
namespace MyNamespace
{
using ColorMap = SortedDictionary<float, Color>;
public class Foo
{
public ColorMap colors = new ColorMap();
...
}
}
In another file (the test for this class), I have:
namespace MyNamespace.Tests
{
public class TestFoo
{
[Fact]
public void TestFooCtor()
{
SortedDirctionary<float, Color> colorMap =
new SortedDirctionary<float, Color>
// Want to be able to just do this:
//ColorMap colorMap = new ColorMap();
...
}
}
}
Is there any way reference ColorMap from my test without repeating myself with another using
directive?
It seems like I should be able to do MyNamespace.ColorMap
? Really, I wish I could make this "typedef" owned by the class Foo, and then be able to reference it by saying Foo.ColorMap
. Neither seem possible in C#? How do I do C++ style typedefs that can be used in client code.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…