What does it mean the prefix "global::" that intellisense is showing me
In my solution I have a project for the business layer and another one to handle integration; in this last one I have a class to make some service methods invocation.
The Business layer references integration project. There, in the business layer, I have the followig method and when I try to create an ins开发者_JAVA百科tance of the Proxy class, intellisense shows me a lot of "global::". I thinks this global:: makes no diference but I want to know why the intellisense is showing me that.
public void ActualizarOrdenesDeCompraDesdeElWS()
{
Integracion.ProxyAudifarma proxy = new global::GOA.Integracion.ProxyAudifarma();
}
I guess this is a trivial C# foundation I'm missing, thanks for your answers.
--Post solution edit:
The calling was:
namespace GOA.Negocio
{
public class GOA
{
public int ActualizarOrdenesDeCompraDesdeElWS()
{
Integracion.ProxyAudifarma proxy = new global::GOA.Integracion.ProxyAudifarma();
Class GOA being named as the root namespace was introducing an ambiguity risk. Changing the class name to AplicacionGOA solved my problem and now intellisense don't set the "global::" empty namespace prefix.
It just resolves to the top-level global namespace to avoid ambiguity with class names, etc that may clash.
See more here from MSDN: http://msdn.microsoft.com/en-us/library/cc713620.aspx
For example, in your code above if you had a class or member or something named GOA, it would clash with that namespace part, putting global:: in front fully qualifies a namespace from its root in the global namespace.
精彩评论