C#

C#

By DeepSource

Obsolete attribute should specify the message CS-R1016

Anti-pattern

Obsolete attribute allows you to mark certain entities as obsolete, thereby discouraging users from using them. However, to convey the full context, it is recommended that you specify the obsolete-message/description. Failing to do so produces a blank line/empty string during the build process and can cause confusion.

Bad Practice

[Obsolete]
public static string OldProperty
   { get { return "The old property value."; } }

Recommended

[Obsolete("This property is obsolete. Use NewProperty instead.")]
   public static string OldProperty
   { get { return "The old property value."; } }

Reference