Property简称属性,其意思就是封装在类或结构里面的数据字段的描述

Attribute简称特性,其意思就是对类或结构的自我描述

还是上代码最好了解:

    /// <summary>
    /// Attribute
    /// </summary>
    [Serializable]
    class Prodcut
    {
        /// <summary>
        /// Property
        /// </summary>
        public string ProdcutName { get; set; }
        /// <summary>
        /// Property
        /// </summary>
        public int Price { get; set; }
    }

这下大家就能区别那个是Property那个是Attribute 吧
好了,只要了解它们之间的区别就可以更好运用它们

相关文章:

  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
猜你喜欢
  • 2021-09-20
  • 2021-06-05
  • 2021-09-12
  • 2021-10-10
  • 2021-12-06
相关资源
相似解决方案