When I add an assembly reference to a project in Visual Studio 8 the Aliases property, of that reference, is set to ‘global’. What is this property good for and why is it set to global?
MSDN tells me that this is a list of aliases for the assembly but not why I might want to use this property or why most are aliased as ‘global’.
This is for ‘extern aliases’. Suppose you want to use two different types, both of which are called
Foo.Bar(i.e.Barin a namespace ofFoo). The two types will be in different assemblies (by definition) – you use the property in VS to associate an alias with each reference, then you can do:and then use
FirstBarandSecondBarin your code.So basically it’s an extra level of naming – and you shouldn’t use it unless you really, really have to. It will confuse a lot of people. Try to avoid getting into that situation in the first place – but be aware of this solution for those times where you just can’t avoid it.