What do you mean by name hiding in C# programming language?

 Posted by Goud.Kv on 9/1/2014 | Category: C# Interview questions | Views: 1688 | Points: 40
Answer:

In some scenarios, we can have both the inner and outer namespaces containing the types with the same name. At this point, name hiding is used.
It states that the priority is given to the type that is present in the inner namespace.

Example,
namespace Home

{
namespace Hall
{
class Television { }
class Furniture { }
namespace DiningRoom
{
class Furniture { }
class Color
{
Furniture DiningFurniture; // Hall.DiningRoom.Furniture (Because of higher priority)
Hall.Furniture HallFurniture; // Hall.Furniture
}
}
}
}


Asked In: Spotted While Learning | Alert Moderator 

Comments or Responses

Login to post response