加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何标记为Delphi中的一个枚举值

发布时间:2020-12-15 10:15:55 所属栏目:大数据 来源:网络整理
导读:我希望如下: TEnumType = ( etValue1 = 1,etValue2 = 2 deprecated,etValue3 = 3); 它返回: [DCC Error] unt_CollectionImportType.pas(19): E2029 ',' or ')' expected but identifier 'deprecated' found. 有没有办法指示编译器不推荐使用此值。 解决方
我希望如下:
TEnumType = (
  etValue1 = 1,etValue2 = 2 deprecated,etValue3 = 3);

它返回:

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

有没有办法指示编译器不推荐使用此值。

解决方法

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读