Namespace problem

Posts   
 
    
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 04-Apr-2005 16:49:54   

Hello friends,

I feel like I can get a better response (quicker too) out of the smart people here than anywhere else on the internet.

That being said, I've got a problem with namespaces in c# that I can't figure out. I've got a utility class named TPO.Infragistics.Utility. Several of the functions in the class reference controls from Infragistics's own namespace which starts with Infragistics.WebUI.... The problem is, Infragistics.WebUI doesn't exist in TPO.Infragistics so the code never compiles.

How do I reference the top level namespace Infragistics from within my own namespace TPO.Infragistics?

Should I (can I) create an alias for Infragistics.WebUI? I just thought of that so I'll give it a try.. no sense in deleting all this typing though so I'll go ahead and post it in case this doesn't work.

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 05-Apr-2005 01:20:15   

alexdresko wrote:

Hello friends,

I feel like I can get a better response (quicker too) out of the smart people here than anywhere else on the internet.

That being said, I've got a problem with namespaces in c# that I can't figure out. I've got a utility class named TPO.Infragistics.Utility. Several of the functions in the class reference controls from Infragistics's own namespace which starts with Infragistics.WebUI.... The problem is, Infragistics.WebUI doesn't exist in TPO.Infragistics so the code never compiles.

How do I reference the top level namespace Infragistics from within my own namespace TPO.Infragistics?

Should I (can I) create an alias for Infragistics.WebUI? I just thought of that so I'll give it a try.. no sense in deleting all this typing though so I'll go ahead and post it in case this doesn't work.

May be you need to add a reference of the assembly that contains the controls with Infragistics.WebUI.... to your proyect.

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 06-Apr-2005 19:12:00   

I think I know the problem you're having. It comes down to namespace resolution/collisions which is determined by whatever imports/using statements you have in place. I would try using an alias like you mentioned. If that doesn't work try removing any imports/using statements for the "TPO.Infragistics" namespace. If that doesn't work you might need to change "TPO.Infragistics" to "TPO.Infra" or something similar.

Jeff...

alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 06-Apr-2005 20:12:25   

jeffreygg wrote:

I think I know the problem you're having. It comes down to namespace resolution/collisions which is determined by whatever imports/using statements you have in place. I would try using an alias like you mentioned. If that doesn't work try removing any imports/using statements for the "TPO.Infragistics" namespace. If that doesn't work you might need to change "TPO.Infragistics" to "TPO.Infra" or something similar.

Jeff...

For the record, the alias worked fine. It was as simple as:

 using infra = Infragistics.WebUI;