简体   繁体   中英

How to mark as deprecated a single enum value in Delphi

I wish to have the following:

TEnumType = (
  etValue1 = 1,
  etValue2 = 2 deprecated,
  etValue3 = 3);

It returns:

[DCC Error] unt_CollectionImportType.pas(19): E2029 ',' or ')' expected 
but identifier 'deprecated' found.

Is there a way to instruct the compiler that this value is deprecated.

type
  TEnumType = (
    etValue1 = 1,
    etDeprecated2 = 2, // was: etValue2; Renamed so we can deprecate it by name
    etValue3 = 3);

const
   etValue2 = etDeprecated2 deprecated; // Declares a constant mapped to the renamed enum value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM