Why can't I reference System.ComponentModel.DataAnnotations?

后端 未结 14 1704
遥遥无期
遥遥无期 2020-11-28 08:47

I\'m trying to use DataAnnotations in my WPF project to specify a maximum length of strings, with the following:

using System.ComponentModel.DataAnnotations;         


        
14条回答
  •  清歌不尽
    2020-11-28 09:27

    To Reference System.ComponentModel.DataAnnotations

    In a code file to have Using System.ComponentModel.DataAnnotations; at the top of the file such as:

    using System.ComponentModel.DataAnnotations;
    

    Add a .NET reference to your project by right clicking the project in solution explorer:

    enter image description here

    Hope this helps! This question helped me.

提交回复
热议问题