Solved

C# namespace conflict ?

Posted on 2002-04-19
1
1,505 Views
Last Modified: 2007-12-19
Is it possible to reference to environments' System namespace if project contains MyOwn.System namespace ?

below is simple example, there the Array class is not found, since only thing it founds from System. is the Sub class...

----
using System;

namespace MyOwn.System
{
  public class Sub
  {
    const int Number = 5;
  }
}

namespace MyOwn
{    
  public class Sub2
  {
    public Sub2()
    {
      System.Array a;   // Array is not found in System
    }
  }
}
0
Comment
Question by:TMan
1 Comment
 
LVL 22

Accepted Solution

by:
CJ_S earned 158 total points
ID: 6957634
You can use the system namespace but you need to adjust your using statement to give the system namespace an alias.

using RealSystem = System;

And I suggest nesting. both together will solve your problem.

using RealSystem = System;

namespace MyOwn
{    
 public class Sub2
 {
   public Sub2()
   {
     RealSystem.Array a;   // Array is not found in System
   }
 }

 namespace System
 {
  public class Sub
  {
    const int Number = 5;
  }
}

}
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now