How can we limit the length of a string to 150 characters?

Posted by jineesh uvantavida on Friday, November 10, 2017 Under: c#

It will be good if your environment support you to use below method.

[StringLength(150)]
public string MyProperty { get; set; }

You have to include the below namespace to use it.

using System.ComponentModel.DataAnnotations;

In : c# 



Translate This Page

 


Make a free website with Yola