編輯

共用方式為


Obsolete attribute

Version: Available or changed with runtime version 4.0.

Specifies that the annotated symbol will be deprecated.

Applies to

  • Method
  • DeclareMethod
  • Variable
  • Event

Syntax

[Obsolete([Reason: Text] [, Tag: Text])]

Arguments

[Optional] Reason
 Type: Text
Specifies the reason for the symbol being deprecated.

[Optional] Tag
 Type: Text
Specifies a free-form text to support tracking of where and when the object was marked as obsolete, for example, branch, build, or date of obsoleting the object.

Remarks

To mark objects and other elements of code, use the ObsoleteState Property and ObsoleteReason Property.

Example

Setting the attribute on a method or a variable. Each method must be marked with [Obsolete('<Reason>','<tag>')].

codeunit 50143 SoonObsolete
{    
       [Obsolete('Pending removal use X instead', '17.0')]
       procedure MyProcedure()
       var
           myInt: Integer;
       begin
           // Make something happen
       end;
}    
    

AL Method Reference
Method Attributes
Directives in AL
Best Practices for Deprecation of Code in the Base App
ObsoleteState Property
ObsoleteReason Property
ObsoleteTag Property