Can I force dependency between namespaces in C #

Is it possible to limit classes from a specific namespace to classes in another specific namespace? Both namespaces exist in the same .NET assembly.

Example:

namespace LegacyCode
{
    class LegacyClass { ... }
}

namespace NewCode
{
    class NewClass {...}
}

I do not want classes from "NewCode" to be able to refer to classes in "LegacyCode".

Parameters:

  • They have different assemblies (simplifies deployment; collection takes longer)
  • Using a tool like NDetect (costs money!)

Does anyone have any other ideas?

+3
source share
5 answers

. , "", .

" " "" , .

Edit:

, . , , . , , , .

# 2:

Dan Tao . , , - , . , . /.

+10

, , . . ( , NDetect.)

, : . , , .

+7

, - .

+3

MS System.ObsoleteAttribute / . ctor, . , , .

+3

, ( ).

. Legacy, . - . - , .

You can even do a daily test for one hour to eliminate as many compiler warnings as you can ... Maybe you can buy a daily beer winner (or soft drink ..;) after work.

+1
source

Source: https://habr.com/ru/post/1755509/


All Articles