麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發(fā)設計 > 正文

DeprecatedAttributevs.ObsoleteAttribute

2019-11-14 13:46:30
字體:
供稿:網(wǎng)友

定義比較

ObsoleteAttribute

[SerializableAttribute][AttributeUsageAttribute(AttributeTargets.Class 
| AttributeTargets.Struct 
| AttributeTargets.Enum 
| AttributeTargets.Constructor 
| AttributeTargets.Method 
| AttributeTargets.PRoperty 
| AttributeTargets.Field 
| AttributeTargets.Event 
| AttributeTargets.Interface 
| AttributeTargets.Delegate,     Inherited = false)][ComVisibleAttribute(true)]public sealed class ObsoleteAttribute : Attribute

 

ObsoleteAttribute is applicable to all program elements except assemblies, modules, parameters, and return values. Marking an element as obsolete informs users that the element will be removed in future versions of the product.

The ObsoleteAttribute class includes two properties:

  • Message. The string assigned to the Message property is emitted by the compiler when the attribute target is used in code. The string should note that the attribute target is obsolete and, if possible, provide some workaround or programmatic alternative.

  • IsError. This is a Boolean value that indicates to the compiler whether using the ObsoleteAttribute attribute should cause it to emit an error (IsError is true) or a warning (IsError is false).

For more information about using attributes, see Extending Metadata Using Attributes.

 

DeprecatedAttribute

 

public sealed class DeprecatedAttribute : Attribute

字面比較

Deprecated: Express disapproval of.

Obsolete: No longer produced or used; out of date.

 

關(guān)于HTML中的這兩個類比是有人這樣解釋的

It is recommended that you don't use deprecated elements, because they will likely not be supported in the future, whereas obsolete elements have already been discontinued from use.

 

MSDN解釋

Directly applying the Windows.Foundation.Metadata.DeprecatedAttribute attribute to managed code is not recommended, because this export occurs automatically.

When you create a Windows Metadata library (.winmd file), the ObsoleteAttribute is exported as both the ObsoleteAttribute attribute and theWindows.Foundation.Metadata.DeprecatedAttribute attribute if only the ObsoleteAttribute is present in source code. The ObsoleteAttribute is transformed to the DeprecatedAttribute as follows:

  • If the message and error arguments are both present, message is assigned to the DeprecatedAttributemessage argument. An error value oftrue maps to DeprecationType.Remove, and an error value of false maps to DeprecationType.Deprecate.

  • If the message argument is not supplied in the ObsoleteAttribute, its default value in the DeprecatedAttribute is "element_name is deprecated", where element_name is the name of the target program element to which the attribute is applied.

  • If the error argument is not present in the ObsoleteAttribute, its default value in the DeprecatedAttribute is DeprecationType.Deprecate.

 

個人理解

不同點:

他們屬于不同的Framework:(DeprecatedAttribute 命名空間 是Windows.Foundation.Metadata而

ObsoleteAttribute的命名空間是System

 

DeprecatedAttribute 是在window8.x 后才開始支持的。

ObsoleteAttribute在.netfraemwork 1.1中引入

 

 

參考

DeprecatedAttribute

ObsoleteAttribute

Obsolete vs. Deprecated HTML


上一篇:C#怎樣通過url調(diào)用接口

下一篇:C#

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 日本搞逼视频 | 久久这| 新久草在线视频 | 精品人成 | 国产88久久久国产精品免费二区 | 日本a∨精品中文字幕在线 被啪羞羞视频在线观看 | 精品国产91久久久久久浪潮蜜月 | 神马久久蜜桃 | 91香蕉影视| 成年人在线免费播放视频 | 午夜生活理论片 | 日本黄色一级电影 | 久久精品一区二区三区不卡牛牛 | 欧美成人午夜一区二区三区 | 国产做爰 | 久草在线最新 | 日韩高清影视 | 日本在线播放一区二区三区 | 奶子吧naiziba.cc免费午夜片在线观看 | av久草| 看全色黄大色黄大片女图片 | 国产99久久久国产精品下药 | 91精品免费在线 | 55夜色66夜色国产精品视频 | xxxx69hd一hd72 | 韩国十九禁高潮床戏在线观看 | 欧美a视频在线观看 | 精品人伦一区二区三区蜜桃网站 | 天天操天天看 | 性爱视频免费 | 天天躁狠狠躁夜躁2020挡不住 | 日韩视频在线观看免费视频 | 国产亚洲精品综合一区 | 毛片免费在线观看 | 九九热在线免费观看视频 | 国产精品久久久久影院老司 | 最新av在线免费观看 | 夜夜夜操操操 | 中文字幕在线播放不卡 | 欧美国产一级片 | 久久久精品视频在线观看 |