?
Solved

C# namespace conflict ?

Posted on 2002-04-19
1
Medium Priority
?
1,567 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
CJ_S earned 632 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Progress
Suggested Courses

777 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