Is there a way for a custom assembly to rename and exposes a type from the 3rd party dll?
// Assembly Foo (cannot change code)
namespace Foo
{
enum XValues
{
Val1, Val2;
}
}
// Assembly Bar
// References Foo
namespace Bar
{
using Foo;
// Code that exposes Foo.XValues as Bar.YValues
}
// Assembly Client
// References Bar
namespace Client
{
void Main() {
Console.WriteLine(Bar.YValues.Val1);
}
}
No, is the short answer. A type is a type is a type. You could create your own enum in
Barwhich has the same values, and convert between them where you need to.What are you trying to achieve – what’s the bigger picture? There may well be a better solution than the one you’re thinking of.