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

后端 未结 14 1714
遥遥无期
遥遥无期 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:45

    System.ComponentModel.DataAnnotations is contained in its own assembly so you need to make sure you have it refernced. Just simply:

    1). Right click on Soloution and choose add.

    2). Choose reference from the list.

    3). Search " System.ComponentModel.DataAnnotation " and tick the check box on its left hand side and press ok.

    Job done, shouldnt have any refernce errors.

提交回复
热议问题