property和attribute都有属性的意思,在xml和html、xaml中的属性都是attribute。

c#中一般property是属性,而attribute是特性的意思。

例如:

 public class Student
    {
        private string name;//字段
        public string Name { get; set; }//property 属性
    }
 [DataContract]//attribute 特性
 public class Student
{
    [DataMember]//attribute 特性
     public string Name{ get; set; }
}

 

相关文章:

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