小编Tu *_* Sy的帖子

c#中[Required]和[Required()]有什么区别

我从github阅读了一些文档,发现在创建对象时存在差异

public class Item
{
    public int Id { get; set; }

    [Required]
    public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

public class Item
{
    public int Id { get; set; }

    [Required()]
    public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

它们之间有什么区别?感谢帮助

c# attributes

2
推荐指数
1
解决办法
58
查看次数

标签 统计

attributes ×1

c# ×1