Can I force a dependency between namespaces in C# -


Can I restrict sections from a specific namespace to referenced sections in specific namespaces? Both namespaces exist in the same .NET assembly.

Example:

  Namespace LegacyCode {class LegacyClass {...}} Namespace NewCode {class NewClass {...}}  

I do not want to enable the class in 'reference' classes in 'legacycode' with 'newcomode'.

Options:

  1. There are different assemblies (make deployment difficult, construction takes longer)
  2. Using device like NintendoTech ( Cost money!)

Do anyone have any other ideas?

Consider marking the squares with this, it would be the cause of any code that would be used during a compilation The warning is not marked as 'obsolete' to generate.

Enable Trace Alerts as 'Errors' on the 'Build' tab of the project file due to this reason instead of warning to fail the compilation with an error.

Edit:

Different assemblies are a good strategy for this code to disappear. Although this will not stop people mentioning it, the obsolete feature makes it clear that this code, um, is obsolete.

Edit # 2:

Thank you for pointing out the obsolete feature that means that you can not use behavioral alarms as errors, Should be considered as or not. An alternative solution is also a useful option for specifying a message giving instructions to the user. This message is displayed during a compilation error / warning


Comments