There already exists an entity with the same name as the one highlighted in the System
namespace. This effectively shadows the built-in entity and prevents you from accessing or instantiating the said built-in entity including the places where the entity is imported, which can cause unintended effects, that can be difficult to debug.
It is therefore recommended that you rename your declaration to avoid this issue.
using System;
namespace Foo
{
class Random // Hides `System.Random`
{
}
class Bar
{
public static void Main()
{
var r = new Random();
}
}
}
using System;
namespace Foo
{
class MyRandomNumberGenerator
{
}
class Bar
{
public static void Main()
{
var r = new MyRandomNumberGenerator();
}
}
}