28 lines
561 B
C#
28 lines
561 B
C#
using System;
|
|
|
|
namespace AvaloniaValidationSample;
|
|
|
|
public class Item
|
|
{
|
|
public int Id { get; set; }
|
|
private string _Password { get; set; }
|
|
public string Password
|
|
{
|
|
get => _Password;
|
|
set
|
|
{
|
|
validatePassword(value);
|
|
_Password = value;
|
|
}
|
|
}
|
|
|
|
public string Text { get; set; }
|
|
|
|
private void validatePassword(string password)
|
|
{
|
|
if (password.Length < 3)
|
|
{
|
|
throw new ArgumentException(nameof(password), "Password length > 7 symbols");
|
|
}
|
|
}
|
|
} |