Solved

C# namespace conflict ?

Posted on 2002-04-19
1
1,527 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
A short article about a problem I had getting the GPS LocationListener working.
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

808 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