{"id":1817,"date":"2024-10-14T10:07:42","date_gmt":"2024-10-14T08:07:42","guid":{"rendered":"https:\/\/epicmarketing.co.il\/notebook\/?p=1817"},"modified":"2024-10-23T10:59:29","modified_gmt":"2024-10-23T08:59:29","slug":"delegates-code-example","status":"publish","type":"post","link":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/","title":{"rendered":"Delegates &#8211; Code Example"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u05e0\u05e8\u05d0\u05d4 \u05e7\u05d5\u05d3 \u05e9\u05de\u05e9\u05ea\u05de\u05e9 \u05d1-delegates \u05d5\u05de\u05e0\u05e6\u05dc \u05d0\u05ea \u05d4\u05d9\u05db\u05d5\u05dc\u05d5\u05ea \u05e9\u05dc\u05d5. \u05e0\u05d1\u05e0\u05d4 \u05d4\u05e8\u05e9\u05de\u05d4 \u05dc\u05de\u05d5\u05e2\u05d3\u05d5\u05df \u05dc\u05d7\u05d1\u05e8\u05d5\u05ea. \u05d4\u05d9\u05ea\u05e8\u05d5\u05df \u05e9\u05dc \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1-delegates \u05d4\u05d5\u05d0 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05e9\u05dc \u05e9\u05d3\u05d5\u05ea. \u05d4\u05de\u05d8\u05e8\u05d4 \u05d4\u05d9\u05d0 \u05dc\u05e0\u05ea\u05e7 \u05d0\u05ea \u05d4\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05d5\u05de\u05e9\u05d3\u05d4 \u05e1\u05e4\u05e6\u05d9\u05e4\u05d9. \u05d9\u05d4\u05d9\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05e7\u05d5\u05d3 \u05d1\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05d5\u05dc\u05d9\u05d9\u05e6\u05e8 \u05e7\u05d5\u05d3 \u05d2\u05de\u05d9\u05e9.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 console app (.Net framework) \u05d1\u05e9\u05dd ClubMembershipApplication. \u05d1\u05ea\u05d5\u05da \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d5\u05ea Models \u05e9\u05d1\u05d4 \u05d9\u05d4\u05d9\u05d5 \u05d4-classes \u05e9\u05dc\u05e0\u05d5. \u05d1\u05ea\u05d5\u05db\u05d4 \u05e0\u05d9\u05e6\u05d5\u05e8 class \u05e9\u05dc User. \u05d4\u05de\u05d5\u05d3\u05dc \u05d4\u05d6\u05d4 \u05d9\u05d7\u05d6\u05d9\u05e7 \u05d0\u05ea \u05d4\u05de\u05d9\u05d3\u05e2 \u05e9\u05dc \u05d4\u05de\u05e9\u05ea\u05de\u05e9 \u05d1\u05ea\u05d4\u05dc\u05d9\u05da \u05d4\u05d4\u05e8\u05e9\u05de\u05d4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05ea\u05d7\u05d9\u05dc\u05d9\u05dd \u05de\u05d1\u05e0\u05d9\u05d9\u05ea \u05d4\u05de\u05d5\u05d3\u05dc \u05d5\u05d0\u05d6 \u05d9\u05d5\u05e6\u05e8\u05d9\u05dd \u05d0\u05ea \u05d4\u05de\u05d1\u05e0\u05d4 \u05e9\u05dc \u05d4-DB \u05de\u05ea\u05d5\u05da \u05d4\u05e7\u05d5\u05d3. \u05d6\u05d0\u05ea \u05d2\u05d9\u05e9\u05d4 \u05e9\u05dc Code First. \u05d0\u05e4\u05e9\u05e8 \u05d2\u05dd \u05dc\u05d9\u05e6\u05d5\u05e8 \u05d0\u05ea \u05d4-DB \u05e7\u05d5\u05d3\u05dd \u05d5\u05d0\u05d6 \u05dc\u05d2\u05e9\u05ea \u05d0\u05dc\u05d9\u05d5 \u05de\u05d4\u05e7\u05d5\u05d3. \u05db\u05d0\u05df \u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05d9\u05d9\u05e6\u05e8\u05d9\u05dd \u05de\u05d5\u05d3\u05dc \u05db-class \u05d5\u05d0\u05d6 \u05de\u05e8\u05d9\u05e6\u05d9\u05dd \u05e4\u05e7\u05d5\u05d3\u05d5\u05ea \u05dc\u05d9\u05e6\u05d5\u05e8 \u05d0\u05ea \u05d4\u05de\u05d1\u05e0\u05d4 \u05d1-DB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>User.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class User\n{\n    &#x5B;DatabaseGenerated(DatabaseGeneratedOption.Identity)]\n    public int Id { get; set; }\n    public string? EmailAddress { get; set; }\n    public string FirstName { get; set; }\n    public string LastName { get; set; }\n    public string Password { get; set; }\n    public DateTime DateOfBirth { get; set; }\n    public string PhoneNumber { get; set; }\n    public string AddressFirstLine { get; set; }\n    public string AddressSecondtLine { get; set; }\n    public string AddressCity { get; set; }\n    public string PostCode { get; set; }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d4-decorator \u05e9\u05d4\u05d5\u05e1\u05e4\u05e0\u05d5: [DatabaseGenerated(DatabaseGeneratedOption.Identity)] \u05de\u05e6\u05d9\u05d9\u05df \u05e9\u05d4-ID \u05d1\u05d8\u05d1\u05dc\u05d4 \u05d9\u05d4\u05d9\u05d4 \u05e9\u05d3\u05d4 \u05d4-Id. \u05d4\u05e9\u05d3\u05d4 \u05d9\u05e7\u05d5\u05d3\u05dd \u05d0\u05d5\u05d8\u05d5\u05de\u05d8\u05d9\u05ea \u05d1\u05db\u05dc \u05e9\u05d5\u05e8\u05d4 \u05e9\u05ea\u05ea\u05d5\u05d5\u05e1\u05e3 \u05dc-DB. \u05e2\u05db\u05e9\u05d9\u05d5 \u05e6\u05e8\u05d9\u05da \u05dc\u05d4\u05ea\u05e7\u05d9\u05df \u05d0\u05ea \u05d4\u05d7\u05d1\u05d9\u05dc\u05d4 \u05e9\u05dc Entity Framework. \u05e0\u05ea\u05e7\u05d9\u05df \u05d0\u05ea Microsoft.EntityFrameworkCore.Sqlite \u05de\u05ea\u05d5\u05da \u05d7\u05dc\u05d5\u05df Nugets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u05d9\u05e6\u05d9\u05e8\u05ea \u05d4-DB<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d9\u05d4 \u05d1\u05e9\u05dd Data \u05d5\u05e0\u05d5\u05e1\u05d9\u05e3 \u05d0\u05dc\u05d9\u05d4 class \u05d1\u05e9\u05dd ClubMembershipDbContext. \u05d4-class \u05d4\u05d6\u05d4 \u05d9\u05d5\u05e8\u05e9 \u05de-DbContext. \u05e0\u05d3\u05e8\u05d5\u05e1 \u05d0\u05ea \u05e4\u05d5\u05e0' OnConfigurring \u05e9\u05de\u05d9\u05d9\u05e6\u05e8\u05ea \u05d0\u05ea \u05d4\u05d2\u05d3\u05e8\u05d5\u05ea \u05d4\u05e7\u05d9\u05e9\u05d5\u05e8 \u05dc-DB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ClubMembershipDbContext.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class ClubMembershipDbContext : DbContext\n{\n    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n    {\n        optionsBuilder.UseSqlite($&quot;Data Source={AppDomain.CurrentDomain.BaseDirectory}ClubMembershipDb.db&quot;);\n        base.OnConfiguring(optionsBuilder);\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05d7\u05e8 \u05db\u05da \u05e0\u05d9\u05e6\u05d5\u05e8 \u05d0\u05ea \u05d4\u05d8\u05d1\u05dc\u05d4 \u05e9\u05e8\u05dc\u05d5\u05d5\u05e0\u05d8\u05d9\u05ea \u05dc-class \u05e9\u05dc\u05e0\u05d5. \u05db\u05e8\u05d2\u05e2 \u05d9\u05e9 \u05dc\u05e0\u05d5 \u05d0\u05ea \u05d4-User.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class ClubMembershipDbContext : DbContext\n{\n    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n    {\n        optionsBuilder.UseSqlite($&quot;Data Source={AppDomain.CurrentDomain.BaseDirectory}ClubMembershipDb.db&quot;);\n        base.OnConfiguring(optionsBuilder);\n    }\n\n    public DbSet&lt;User&gt; Users { get; set; }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">EF \u05d9\u05e9\u05ea\u05de\u05e9 \u05d1-Users \u05db\u05d3\u05d9 \u05dc\u05d4\u05d5\u05e1\u05d9\u05e3 \u05de\u05d9\u05d3\u05e2 \u05dc\u05d8\u05d1\u05dc\u05d4. \u05db\u05d3\u05d9 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d6\u05d4 \u05e0\u05e6\u05d8\u05e8\u05e3 \u05dc\u05d4\u05d5\u05e1\u05d9\u05e3 Migration. \u05e0\u05d5\u05e1\u05d9\u05e3 \u05d0\u05ea Entity Framework Core Tools \u05d3\u05e8\u05da Nugets \u05d5\u05d0\u05d6 \u05e0\u05e4\u05ea\u05d7 \u05d0\u05ea \u05d4\u05e7\u05d5\u05e0\u05e1\u05d5\u05dc \u05e9\u05dc \u05d4-Nugets \u05d5\u05e0\u05d5\u05e1\u05d9\u05e3:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nAdd-Migration FirstCreate\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d5\u05e1\u05e4\u05d4 \u05dc\u05e0\u05d5 \u05ea\u05d9\u05e7\u05d9\u05d9\u05ea Migrations \u05d5\u05e9\u05dd \u05e7\u05d5\u05d3 \u05dc\u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05d8\u05d1\u05dc\u05d4 \u05e9\u05dc\u05e0\u05d5.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05db\u05d3\u05d9 \u05dc\u05d4\u05e8\u05d9\u05e5 \u05d0\u05ea \u05d4-Migration \u05e0\u05e8\u05d9\u05e5 \u05d1\u05e7\u05d5\u05e0\u05e1\u05d5\u05dc Nugets \u05d0\u05ea \u05d4\u05e4\u05e7\u05d5\u05d3\u05d4:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nupdate-database\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05ea\u05d9\u05e7\u05d9\u05d9\u05ea \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05d1\u05ea\u05d5\u05da bin\/debug \u05e0\u05d5\u05db\u05dc \u05dc\u05e8\u05d0\u05d5\u05ea \u05d0\u05ea \u05e7\u05d5\u05d1\u05e5 db \u05e9\u05e0\u05d5\u05e6\u05e8. \u05db\u05d3\u05d9 \u05dc\u05e6\u05e4\u05d5\u05ea \u05d1\u05de\u05d4 \u05e9\u05e0\u05d5\u05e6\u05e8 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05d5\u05e8\u05d9\u05d3 \u05d0\u05ea<a href=\"https:\/\/sqlitebrowser.org\/\" target=\"_blank\" rel=\"noreferrer noopener\"> DB Browser for SQLite<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Class \u05d4-Delegates<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05ea\u05d7\u05ea \u05d0\u05d5\u05ea\u05d5 solution \u05e0\u05d9\u05e6\u05d5\u05e8 \u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05d7\u05d3\u05e9 \u05de\u05e1\u05d5\u05d2 class library. \u05e0\u05e9\u05ea\u05de\u05e9 \u05d1\u05d5 \u05dc\u05d9\u05e6\u05d9\u05e8\u05ea validation \u05e8\u05d1 \u05e4\u05e2\u05de\u05d9. \u05e0\u05e7\u05e8\u05d0 \u05dc\u05d5 FieldValidationAPI.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05e1\u05d9\u05e8 \u05d0\u05ea \u05d4-class \u05e9\u05de\u05d2\u05d9\u05e2 \u05e2\u05dd \u05d4\u05e4\u05e8\u05d5\u05d9\u05e7\u05d8 \u05d5\u05e0\u05d9\u05e6\u05d5\u05e8 \u05d7\u05d3\u05e9 \u05d1\u05e9\u05dd CommonFieldValidatorFunctions. \u05e0\u05d4\u05e4\u05d5\u05da \u05d0\u05ea \u05d4-class \u05dc-public. \u05e0\u05d9\u05e6\u05d5\u05e8 5 \u05d4\u05d2\u05d3\u05e8\u05d5\u05ea delegates. \u05dc\u05db\u05dc \u05d0\u05d7\u05ea \u05e0\u05d9\u05d9\u05e6\u05e8 \u05de\u05e9\u05ea\u05e0\u05d4.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ See that a field is not empty\npublic delegate bool RequiredValidDel(string fieldVal);\n\/\/ Constrain a value of a field between min and max value\npublic delegate bool StringLengthValidDel(string fieldVal, int min, int max);\n\/\/ Date validator\npublic delegate bool DateValidDel(string fieldVal, out DateTime validDateTime);\n\/\/ Valid a field value compare to a regular expression\npublic delegate bool PattenMatchValidDel(string fieldVal, string pattern);\n\/\/ Validate a text field compare to another text field\npublic delegate bool CompareFieldsValidDel(string fieldVal, string fieldValCompare);\n\npublic class CommonFieldValidatorFunctions\n{\n    private static RequiredValidDel _requiredValidDel = null;\n    private static StringLengthValidDel _stringLengthValidDel = null;\n    private static DateValidDel _dateValidDel = null;\n    private static PattenMatchValidDel _pattenMatchValidDel = null;\n    private static CompareFieldsValidDel _compareFieldsValidDel = null;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d4-delegates \u05d4\u05dd \u05e1\u05d5\u05d2 \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd \u05d4\u05de\u05d9\u05d9\u05e6\u05d2 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05e2\u05dd \u05d7\u05ea\u05d9\u05de\u05d4 \u05de\u05e1\u05d5\u05d9\u05de\u05ea. \u05d4\u05dd \u05de\u05d0\u05e4\u05e9\u05e8\u05d9\u05dd \u05dc\u05d4\u05e2\u05d1\u05d9\u05e8 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05db\u05e4\u05e8\u05de\u05d8\u05e8\u05d9\u05dd \u05d5\u05dc\u05d4\u05e4\u05e2\u05d9\u05dc \u05d0\u05d5\u05ea\u05df \u05d1\u05d0\u05d5\u05e4\u05df \u05d3\u05d9\u05e0\u05de\u05d9.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05dc\u05de\u05e9\u05dc: RequiredValidDel \u05d4\u05d5\u05d0 delegate \u05d4\u05de\u05d9\u05d9\u05e6\u05d2 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05e9\u05de\u05e7\u05d1\u05dc\u05ea \u05de\u05d7\u05e8\u05d5\u05d6\u05ea \u05d5\u05de\u05d7\u05d6\u05d9\u05e8\u05d4 \u05e2\u05e8\u05da \u05d1\u05d5\u05dc\u05d9\u05d0\u05e0\u05d9 \u05d4\u05de\u05e6\u05d1\u05d9\u05e2 \u05d0\u05dd \u05d4\u05e9\u05d3\u05d4 \u05d0\u05d9\u05e0\u05d5 \u05e8\u05d9\u05e7. \u05d5\u05db\u05df \u05d4\u05dc\u05d0\u05d4 \u05d1\u05db\u05dc \u05d4\u05d2\u05d3\u05e8\u05d5\u05ea \u05d4-delegates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d5\u05ea \u05d4\u05e1\u05d8\u05d8\u05d9\u05d9\u05dd \u05de\u05e9\u05de\u05e9\u05d9\u05dd \u05dc\u05d0\u05d7\u05e1\u05d5\u05df delegate instances.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u05e9\u05d3\u05d4 static \u05de\u05e7\u05d5\u05e9\u05e8 \u05dc-class \u05e2\u05e6\u05de\u05d5 \u05d5\u05dc\u05d0 \u05dc\u05de\u05d5\u05e4\u05e2 \u05de\u05e1\u05d5\u05d9\u05d9\u05dd \u05e9\u05dc \u05d4-class. <\/strong>\u05dc\u05d0 \u05de\u05e9\u05e0\u05d4 \u05db\u05de\u05d4 \u05de\u05d5\u05e4\u05e2\u05d9\u05dd \u05e9\u05dc \u05d4-class \u05e0\u05d9\u05e6\u05d5\u05e8, \u05d4\u05de\u05e9\u05ea\u05e0\u05d4 \u05d4\u05e1\u05d8\u05d8\u05d9 \u05d9\u05d4\u05d9\u05d4 \u05e7\u05d9\u05d9\u05dd \u05e8\u05e7 \u05e4\u05e2\u05dd \u05d0\u05d7\u05ea, \u05db\u05dc \u05d4\u05de\u05d5\u05e4\u05e2\u05d9\u05dd \u05e9\u05dc \u05d4-class \u05d7\u05d5\u05dc\u05e7\u05d9\u05dd \u05d0\u05ea \u05d0\u05d5\u05ea\u05d5 \u05d4\u05de\u05e9\u05ea\u05e0\u05d4. \u05dc\u05de\u05e9\u05ea\u05e0\u05d9\u05dd \u05d4\u05e1\u05d8\u05d8\u05d9\u05dd \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d2\u05e9\u05ea \u05d2\u05dd \u05d1\u05dc\u05d9 \u05dc\u05d9\u05e6\u05d5\u05e8 \u05de\u05d5\u05e4\u05e2 \u05e9\u05dc \u05d4-class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d5\u05ea \u05d4\u05e1\u05d8\u05d8\u05d9\u05d9\u05dd \u05d1\u05e7\u05d5\u05d3 \u05de\u05d0\u05d7\u05e1\u05e0\u05d9\u05dd \u05d0\u05ea \u05d4-delegates \u05e9\u05dc \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05d4\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05d4\u05e9\u05d5\u05e0\u05d5\u05ea, \u05dc\u05db\u05dc \u05e9\u05d3\u05d4 \u05db\u05d6\u05d4 \u05e0\u05d1\u05e0\u05d4 \u05de\u05d0\u05d5\u05d7\u05e8 \u05d9\u05d5\u05ea\u05e8 property \u05e9\u05ea\u05d0\u05ea\u05d7\u05dc \u05d0\u05d5\u05ea\u05d5 \u05d1\u05de\u05d9\u05d3\u05ea \u05d4\u05e6\u05d5\u05e8\u05da. \u05d1\u05e8\u05d2\u05e2 \u05e9\u05e0\u05d9\u05e6\u05d5\u05e8 \u05d0\u05ea \u05d4-delegate \u05e0\u05d0\u05d7\u05e1\u05df \u05d0\u05d5\u05ea\u05d5 \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05db\u05ea\u05d5\u05d1 \u05d0\u05ea \u05d4\u05d9\u05d9\u05e9\u05d5\u05dd \u05e9\u05dc \u05d4-delegates \u05e9\u05d9\u05e6\u05e8\u05e0\u05d5. \u05d0\u05dc\u05d5 \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05e9\u05e0\u05e8\u05e6\u05d4 \u05e9\u05d4-delegate \u05d9\u05e7\u05e8\u05d0 \u05dc\u05d4\u05df \u05db\u05e9\u05de\u05e4\u05e2\u05d9\u05dc\u05d9\u05dd \u05d0\u05d5\u05ea\u05d5.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class CommonFieldValidatorFunctions\n{\n    private static RequiredValidDel _requiredValidDel = null;\n    private static StringLengthValidDel _stringLengthValidDel = null;\n    private static DateValidDel _dateValidDel = null;\n    private static PattenMatchValidDel _pattenMatchValidDel = null;\n    private static CompareFieldsValidDel _compareFieldsValidDel = null;\n\n    private static bool RequiredFieldValid(string fieldVal)\n    {\n        if (!string.IsNullOrEmpty(fieldVal))\n            return true;\n        return false;\n    }\n\n    private static bool StringFieldLengthValid(string fieldVal, int min, int max)\n    {\n        if (fieldVal.Length &gt;= min &amp;&amp; fieldVal.Length &lt;= max)\n            return true;\n        return false;\n    }\n\n    private static bool DateFieldValid(string dateTime, out DateTime validDateTime)\n    {\n        if (DateTime.TryParse(dateTime, out validDateTime))\n            return true;\n        return false;\n    }\n\n    private static bool FieldPatternValid(string fieldVal, string regularExpressionPattern)\n    {\n        Regex regex = new Regex(regularExpressionPattern);\n\n        if (regex.IsMatch(fieldVal))\n            return true;\n        return false;\n    }\n\n    private static bool FieldComparisonValid(string field1, string field2)\n    {\n        if (field1.Equals(field2))\n            return true;\n        return false;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05e0\u05d7\u05e9\u05d5\u05e3 \u05d0\u05ea \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05e9\u05d4\u05df private \u05db\u05d3\u05d9 \u05e9\u05d9\u05d4\u05d9\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d4\u05df. \u05e0\u05d9\u05e6\u05d5\u05e8 property \u05de\u05ea\u05d0\u05d9\u05dd \u05dc\u05db\u05dc delegate. \u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05e4\u05d4 \u05d1-Singleton Pattern \u05db\u05d3\u05d9 \u05dc\u05d4\u05d9\u05d5\u05ea \u05d1\u05d8\u05d5\u05d7\u05d9\u05dd \u05e9\u05e8\u05e7 \u05de\u05d5\u05e4\u05e2 \u05d0\u05d7\u05d3 \u05e9\u05dc \u05db\u05dc \u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8 \u05d9\u05d5\u05d5\u05e6\u05e8.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class CommonFieldValidatorFunctions\n{\n    private static RequiredValidDel _requiredValidDel = null;\n    ...\n\n    public static RequiredValidDel RequiredFieldValidDel\n    {\n        get\n        {\n            if (_requiredValidDel == null)\n                _requiredValidDel = new RequiredValidDel(RequiredFieldValid);\n            return _requiredValidDel;\n        }\n    }\n\n    public static StringLengthValidDel StringLengthFieldValid\n    {\n        get\n        {\n            if (_stringLengthValidDel == null)\n                _stringLengthValidDel = new StringLengthValidDel(StringFieldLengthValid);\n            return _stringLengthValidDel;\n        }\n    }\n\n    public static DateValidDel DateFieldValidDel\n    {\n        get\n        {\n            if (_dateValidDel == null)\n                _dateValidDel = new DateValidDel(DateFieldValid);\n            return _dateValidDel;\n        }\n    }\n\n    public static PattenMatchValidDel PattenMatchValidDel\n    {\n        get\n        {\n            if (_pattenMatchValidDel == null)\n                _pattenMatchValidDel = new PattenMatchValidDel(FieldPatternValid);\n            return _pattenMatchValidDel;\n        }\n    }\n\n    public static CompareFieldsValidDel FieldsCompareValidDel\n    {\n        get\n        {\n            if (_compareFieldsValidDel == null)\n                _compareFieldsValidDel = new CompareFieldsValidDel(FieldComparisonValid);\n            return _compareFieldsValidDel;\n        }\n    }\n\n    private static bool RequiredFieldValid(string fieldVal)\n    {\n        if (!string.IsNullOrEmpty(fieldVal))\n            return true;\n        return false;\n    }\n\n    ...\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">\u05dc\u05e1\u05d9\u05db\u05d5\u05dd \u05e2\u05d3 \u05db\u05d4:<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d5\u05ea \u05d4-static \u05d1-CommonFieldValidatorFunctions \u05de\u05d0\u05d7\u05e1\u05e0\u05d9\u05dd \u05de\u05d5\u05e4\u05e2\u05d9\u05dd \u05e9\u05dc delegates \u05e9\u05e0\u05d8\u05e2\u05e0\u05d9\u05dd \u05d1\u05d0\u05d5\u05e4\u05df \u05d7\u05d3 \u05e4\u05e2\u05de\u05d9 \u05db\u05d0\u05e9\u05e8 \u05d9\u05e9 \u05d1\u05d4\u05dd \u05e9\u05d9\u05de\u05d5\u05e9. \u05db\u05dc delegate \u05e0\u05d5\u05e6\u05e8 \u05e4\u05e2\u05dd \u05d0\u05d7\u05ea \u05d5\u05de\u05d5\u05db\u05df \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05db\u05d0\u05e9\u05e8 \u05d9\u05e9 \u05d0\u05dc\u05d9\u05d5 \u05d2\u05d9\u05e9\u05d4 \u05de\u05db\u05dc \u05de\u05e7\u05d5\u05dd \u05dc\u05dc\u05d0 \u05e6\u05d5\u05e8\u05da \u05d1\u05d9\u05e6\u05d9\u05e8\u05ea \u05de\u05d5\u05e4\u05e2 \u05e9\u05dc \u05d4-class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 class \u05d1\u05e9\u05dd CommonRegularExpressionValidationPatterns. \u05d4-class \u05d9\u05db\u05d9\u05dc \u05d1\u05d9\u05d8\u05d5\u05d9\u05d9\u05dd \u05e9\u05d1\u05d4\u05dd \u05d9\u05e2\u05e9\u05d4 \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1\u05ea\u05d5\u05db\u05e0\u05d9\u05ea \u05e9\u05dc\u05e0\u05d5. \u05d0\u05ea \u05d4\u05d1\u05d9\u05d8\u05d5\u05d9\u05d9\u05dd \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d9\u05e6\u05e8 \u05e2\u05dc \u05d9\u05d3\u05d9 \u05de\u05d7\u05d5\u05dc\u05dc regex \u05db\u05dc\u05e9\u05d4\u05d5.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>CommonRegularExpressionValidationPatterns.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic static class CommonRegularExpressionValidationPatterns\n{\n    public const string Email_Address_RegEx_Pattern = @&quot;^&#x5B;\\w-\\.]+@(&#x5B;\\w-]+\\.)+&#x5B;\\w-]{2,4}$&quot;;\n\n    public const string Uk_PhoneNumber_RegEx_Pattern = @&quot;^\\(?(?:(?:0(?:0|11)\\)?&#x5B;\\s-]?\\(?|\\+)44\\)?&#x5B;\\s-]?\\(?(?:0\\)?&#x5B;\\s-]?\\(?)?|0)(?:\\d{2}\\)?&#x5B;\\s-]?\\d{4}&#x5B;\\s-]?\\d{4}|\\d{3}\\)?&#x5B;\\s-]?\\d{3}&#x5B;\\s-]?\\d{3,4}|\\d{4}\\)?&#x5B;\\s-]?(?:\\d{5}|\\d{3}&#x5B;\\s-]?\\d{3})|\\d{5}\\)?&#x5B;\\s-]?\\d{4,5}|8(?:00&#x5B;\\s-]?11&#x5B;\\s-]?11|45&#x5B;\\s-]?46&#x5B;\\s-]?4\\d))(?:(?:&#x5B;\\s-]?(?:x|ext\\.?\\s?|\\#)\\d+)?)$&quot;;\n\n    public const string Uk_Post_Code_RegEx_Pattern = @&quot;(&#x5B;Gg]&#x5B;Ii]&#x5B;Rr] 0&#x5B;Aa]{2})|(((&#x5B;A-Za-z]&#x5B;0-9]{1,2})|((&#x5B;A-Za-z]&#x5B;A-Ha-hJ-Yj-y]&#x5B;0-9]{1,2})|((&#x5B;A-Za-z]&#x5B;0-9]&#x5B;A-Za-z])|(&#x5B;A-Za-z]&#x5B;A-Ha-hJ-Yj-y]&#x5B;0-9]&#x5B;A-Za-z]?))))\\s?&#x5B;0-9]&#x5B;A-Za-z]{2})&quot;;\n\n    public const string Strong_Password_RegEx_Pattern = @&quot;(?=^.{6,10}$)(?=.*\\d)(?=.*&#x5B;a-z])(?=.*&#x5B;A-Z])(?=.*&#x5B;!@#$%^&amp;amp;*()_+}{&amp;quot;:;&#039;?\/&amp;gt;.&amp;lt;,])(?!.*\\s).*$&quot;;\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u05d4\u05d2\u05d3\u05e8\u05ea \u05de\u05d1\u05e0\u05d4 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d5\u05ea<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05e0\u05d7\u05d6\u05d5\u05e8 \u05dc\u05ea\u05d5\u05db\u05e0\u05d9\u05ea \u05d4\u05e8\u05d0\u05e9\u05d9\u05ea \u05d5\u05e9\u05dd \u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d9\u05d4 \u05d7\u05d3\u05e9\u05d4 \u05d1\u05e9\u05dd FieldValidators. \u05db\u05dc class \u05d9\u05ea\u05d0\u05d9\u05dd \u05dc-view \u05e1\u05e4\u05e6\u05d9\u05e4\u05d9.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05ea\u05d5\u05da \u05d4\u05ea\u05d9\u05e7\u05d9\u05d9\u05d4 \u05e0\u05d9\u05e6\u05d5\u05e8 Interface \u05d1\u05e9\u05dd IFieldValidator. \u05d1\u05ea\u05d5\u05db\u05d5 \u05e0\u05d9\u05e6\u05d5\u05e8 delegate \u05e9\u05d9\u05d5\u05db\u05dc \u05dc\u05d1\u05e6\u05e2 \u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d5\u05ea \u05e2\u05dc \u05db\u05dc \u05d8\u05d5\u05e4\u05e1 \u05e9\u05d9\u05d4\u05d9\u05d4 \u05dc\u05e0\u05d5. \u05db\u05e8\u05d2\u05e2 \u05e0\u05ea\u05d7\u05d9\u05dc \u05e2\u05dd \u05d8\u05d5\u05e4\u05e1 \u05e9\u05dc \u05e4\u05e8\u05d8\u05d9 \u05de\u05e9\u05ea\u05de\u05e9, \u05d0\u05d1\u05dc \u05e0\u05e0\u05d9\u05d7 \u05e9\u05d0\u05e0\u05d7\u05e0\u05d5 \u05e8\u05d5\u05e6\u05d9\u05dd \u05dc\u05d1\u05e6\u05e2 \u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d5\u05ea \u05e2\u05dc \u05d8\u05d5\u05e4\u05e1 \u05e9\u05dc \u05e4\u05e8\u05d8\u05d9 \u05d1\u05e0\u05e7, \u05e0\u05d5\u05db\u05dc \u05dc\u05d9\u05e6\u05d5\u05e8 class \u05dc\u05de\u05d8\u05e8\u05d4 \u05d4\u05d6\u05d0\u05ea \u05d5\u05d0\u05d6 \u05e0\u05d5\u05db\u05dc \u05dc\u05e4\u05e0\u05d5\u05ea \u05dc-validator \u05d4\u05de\u05ea\u05d0\u05d9\u05dd \u05d5\u05dc\u05d1\u05e6\u05e2 \u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05dc\u05e9\u05d3\u05d5\u05ea.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d4: fieldIndex \u05de\u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05ea\u05d9\u05d9\u05d7\u05e1 \u05dc\u05e9\u05d3\u05d4 \u05de\u05e1\u05d5\u05d9\u05d9\u05dd \u05d1\u05ea\u05d5\u05da \u05de\u05e2\u05e8\u05da \u05e9\u05dc \u05e9\u05d3\u05d5\u05ea.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d4: fieldValue \u05de\u05d9\u05d9\u05e6\u05d2 \u05d0\u05ea \u05e2\u05e8\u05da \u05d4\u05e9\u05d3\u05d4 \u05e9\u05e0\u05e9\u05dc\u05d7 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d4: fieldArray \u05de\u05d0\u05d7\u05e1\u05df \u05d0\u05ea \u05d4\u05e9\u05d3\u05d5\u05ea \u05e9\u05e2\u05d1\u05e8\u05d5 \u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05dc-view \u05de\u05e1\u05d5\u05d9\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e9\u05d3\u05d4: fieldInvalidMessage \u05de\u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05d5\u05d3\u05e2\u05ea \u05e9\u05d2\u05d9\u05d0\u05d4 \u05dc\u05d4\u05d2\u05d9\u05e2 \u05d7\u05d6\u05e8\u05d4 \u05dc\u05e7\u05d5\u05d3 \u05e9\u05e7\u05e8\u05d0 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> <strong>IFieldValidator.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic delegate bool FieldValidatorDel(int fieldIndex, string fieldValue, string&#x5B;] fieldArray, out string fieldInvalidMessage);\n\npublic interface IFieldValidator\n{\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05ea\u05d5\u05da \u05d4-interface \u05e0\u05d2\u05d3\u05d9\u05e8:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">InitialiseValidatorDelegates &#8211; \u05e4\u05d5\u05e0' \u05dc\u05d0\u05ea\u05d7\u05d5\u05dc \u05e9\u05dc \u05d4-delegate \u05dc-view \u05de\u05e1\u05d5\u05d9\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">FieldArray &#8211; \u05de\u05e2\u05e8\u05da \u05e9\u05de\u05d0\u05d7\u05e1\u05df \u05d0\u05ea \u05e2\u05e8\u05db\u05d9 \u05d4\u05e9\u05d3\u05d5\u05ea \u05dc\u05d1\u05d3\u05d9\u05e7\u05d4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ValidatorDel &#8211; \u05d0\u05d7\u05e8\u05d0\u05d9 \u05e2\u05dc \u05d4-delegate \u05e9\u05e6\u05e8\u05d9\u05da \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d5.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic delegate bool FieldValidatorDel(int fieldIndex, string fieldValue, string&#x5B;] fieldArray, out string fieldInvalidMessage);\npublic interface IFieldValidator\n{\n    void InitialiseValidatorDelegates();\n    string&#x5B;] FieldArray { get; }\n    FieldValidatorDel ValidatorDel { get; }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 \u05de\u05e2\u05e8\u05da \u05e9\u05de\u05db\u05d9\u05dc \u05e2\u05e8\u05db\u05d9 \u05e9\u05d3\u05d5\u05ea. \u05d1\u05ea\u05d9\u05e7\u05d9\u05d9\u05ea FieldValidators \u05e0\u05d9\u05e6\u05d5\u05e8 class \u05d1\u05e9\u05dd FieldConstants.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">FieldConstants.cs<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class FieldConstants\n{\n    public enum UserRegistrationField\n    {\n        EmailAddress,\n        FirstName,\n        LastName,\n        Password,\n        PasswordCompare,\n        DateOfBirth,\n        PhoneNumber,\n        AddressFirstLine,\n        AddressSecondLine,\n        AddressCity,\n        PostCode\n    }\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u05de\u05d9\u05de\u05d5\u05e9 IFieldValidator<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05e0\u05d9\u05e6\u05d5\u05e8 \u05d0\u05ea \u05d4-class \u05e9\u05d9\u05de\u05de\u05e9 \u05d0\u05ea \u05d4-interface \u05d1\u05e9\u05dd UserRegistrationValidator.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05e8\u05d0\u05e9, \u05d4\u05d2\u05d3\u05e8\u05ea \u05e7\u05d1\u05d5\u05e2\u05d9\u05dd \u05dc\u05d2\u05d1\u05d9 \u05d4\u05d0\u05d5\u05e8\u05da \u05e9\u05dc \u05d4\u05e7\u05dc\u05d8 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d9 \u05d5\u05d4\u05d2\u05d3\u05e8\u05ea delegate \u05dc\u05d1\u05d3\u05d9\u05e7\u05d4 \u05d4\u05d0\u05dd \u05db\u05ea\u05d5\u05d1\u05ea \u05d4\u05de\u05d9\u05d9\u05dc \u05db\u05d1\u05e8 \u05e7\u05d9\u05d9\u05de\u05ea \u05d1-DB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>UserRegistrationValidator.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationValidator : IFieldValidator\n{\n    const int FirstName_Min_Length = 2;\n    const int FirstName_Max_Length = 100;\n    const int LastName_Min_Length = 2;\n    const int LastName_Max_Length = 100;\n\n    \/\/ Check if the user email already exists in users table\n    delegate bool EmailExistsDel(string emailAddress);\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05d7\u05e8 \u05db\u05da \u05d4\u05d2\u05d3\u05e8\u05ea \u05de\u05e9\u05ea\u05e0\u05d9\u05dd \u05e9\u05d9\u05d7\u05d6\u05d9\u05e7\u05d5 \u05d0\u05ea \u05d4-delegates \u05dc\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05d4\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationValidator : IFieldValidator\n{\n    const int FirstName_Min_Length = 2;\n    ...\n\n    FieldValidatorDel _fieldValidatorDel = null;\n\n    RequiredValidDel _requiredValidDel = null;\n    StringLengthValidDel _stringLengthValidDel = null;\n    DateValidDel _dateValidDel = null;\n    PattenMatchValidDel _pattenMatchValidDel = null;\n    CompareFieldsValidDel _compareFieldsValidDel = null;\n\n    EmailExistsDel _emailExistsDel = null;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05ea \u05db\u05dc \u05d4\u05e2\u05e8\u05db\u05d9\u05dd \u05e9\u05dc \u05d4\u05d8\u05d5\u05e4\u05e1 \u05d0\u05e0\u05d7\u05e0\u05d5 \u05e8\u05d5\u05e6\u05d9\u05dd \u05dc\u05d0\u05d7\u05e1\u05df \u05d1\u05de\u05e2\u05e8\u05da. \u05d4\u05de\u05e2\u05e8\u05da \u05e0\u05d5\u05e6\u05e8 \u05db\u05d0\u05e9\u05e8 \u05e0\u05d9\u05d2\u05e9\u05d9\u05dd \u05d0\u05dc\u05d9\u05d5 \u05d1\u05e4\u05e2\u05dd \u05d4\u05e8\u05d0\u05e9\u05d5\u05e0\u05d4.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationValidator : IFieldValidator\n{\n    const int FirstName_Min_Length = 2;\n    ...\n\n    FieldValidatorDel _fieldValidatorDel = null;\n    ...\n\n    string&#x5B;] _fieldArray = null;\n\n    public string&#x5B;] FieldArray\n    {\n        get\n        {\n            if (_fieldArray == null)\n                _fieldArray = new string&#x5B;Enum.GetValues(typeof(FieldConstants.UserRegistrationField)).Length];\n            return _fieldArray;\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 \u05e0\u05e7\u05d5\u05d3\u05ea \u05db\u05e0\u05d9\u05e1\u05d4 \u05dc-delegate \u05e9\u05dc \u05d4-validation \u05d5\u05e0\u05d0\u05ea\u05d7\u05dc \u05d0\u05ea \u05db\u05dc \u05d4\u05de\u05d5\u05e4\u05e2\u05d9\u05dd \u05e9\u05dc \u05d4-delegate \u05e9\u05e0\u05e6\u05d8\u05e8\u05da.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationValidator : IFieldValidator\n{\n    const int FirstName_Min_Length = 2;\n    ...\n\n    FieldValidatorDel _fieldValidatorDel = null;\n    ...\n\n    string&#x5B;] _fieldArray = null;\n    ...\n\n    public FieldValidatorDel ValidatorDel =&gt; _fieldValidatorDel;\n\n    public void InitialiseValidatorDelegates()\n    {\n        _fieldValidatorDel = new FieldValidatorDel(ValidateField);\n\n        _requiredValidDel = CommonFieldValidatorFunctions.RequiredFieldValidDel;\n        _stringLengthValidDel = CommonFieldValidatorFunctions.StringLengthFieldValid;\n        _dateValidDel = CommonFieldValidatorFunctions.DateFieldValidDel;\n        _pattenMatchValidDel = CommonFieldValidatorFunctions.PattenMatchValidDel;\n        _compareFieldsValidDel = CommonFieldValidatorFunctions.FieldsCompareValidDel;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e2\u05d1\u05d5\u05e8 \u05e2\u05dc \u05d4\u05e9\u05d3\u05d5\u05ea \u05d5\u05dc\u05d1\u05e6\u05e2 \u05dc\u05d4\u05dd \u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05db\u05e9\u05d1\u05e7\u05d5\u05d3 \u05e4\u05d4 \u05e8\u05d5\u05d0\u05d9\u05dd \u05d0\u05ea \u05d4\u05d5\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05e9\u05dc \u05e9\u05d3\u05d4 \u05d4\u05d0\u05d9\u05de\u05d9\u05d9\u05dc.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationValidator : IFieldValidator\n{\n    const int FirstName_Min_Length = 2;\n    ...\n\n    FieldValidatorDel _fieldValidatorDel = null;\n    ...\n\n    string&#x5B;] _fieldArray = null;\n    ...\n\n    public FieldValidatorDel ValidatorDel =&gt; _fieldValidatorDel;\n    ...\n\n    private bool ValidateField(int fieldIndex, string fieldValue, string&#x5B;] fieldArray, out string fieldInvalidMessage)\n    {\n        fieldInvalidMessage = &quot;&quot;;\n\n        FieldConstants.UserRegistrationField userRegistrationField = (FieldConstants.UserRegistrationField)fieldIndex;\n\n        switch (userRegistrationField) \n        {\n            case FieldConstants.UserRegistrationField.EmailAddress:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_pattenMatchValidDel(fieldValue, CommonRegularExpressionValidationPatterns.Email_Address_RegEx_Pattern)) ? $&quot;You must enter a valid email address{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n        }\n\n        return (fieldInvalidMessage == &quot;&quot;);\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e7\u05d5\u05d1\u05e5 \u05d4\u05e9\u05dc\u05dd:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationValidator : IFieldValidator\n{\n    const int FirstName_Min_Length = 2;\n    const int FirstName_Max_Length = 100;\n    const int LastName_Min_Length = 2;\n    const int LastName_Max_Length = 100;\n\n    \/\/ Check if the user email already exists in users table\n    delegate bool EmailExistsDel(string emailAddress);\n\n    FieldValidatorDel _fieldValidatorDel = null;\n\n    RequiredValidDel _requiredValidDel = null;\n    StringLengthValidDel _stringLengthValidDel = null;\n    DateValidDel _dateValidDel = null;\n    PattenMatchValidDel _pattenMatchValidDel = null;\n    CompareFieldsValidDel _compareFieldsValidDel = null;\n\n    EmailExistsDel _emailExistsDel = null;\n\n    string&#x5B;] _fieldArray = null;\n\n    public string&#x5B;] FieldArray\n    {\n        get\n        {\n            if (_fieldArray == null)\n                _fieldArray = new string&#x5B;Enum.GetValues(typeof(FieldConstants.UserRegistrationField)).Length];\n            return _fieldArray;\n        }\n    }\n\n    public FieldValidatorDel ValidatorDel =&gt; _fieldValidatorDel;\n\n    public void InitialiseValidatorDelegates()\n    {\n        _fieldValidatorDel = new FieldValidatorDel(ValidateField);\n\n        _requiredValidDel = CommonFieldValidatorFunctions.RequiredFieldValidDel;\n        _stringLengthValidDel = CommonFieldValidatorFunctions.StringLengthFieldValid;\n        _dateValidDel = CommonFieldValidatorFunctions.DateFieldValidDel;\n        _pattenMatchValidDel = CommonFieldValidatorFunctions.PattenMatchValidDel;\n        _compareFieldsValidDel = CommonFieldValidatorFunctions.FieldsCompareValidDel;\n    }\n\n    private bool ValidateField(int fieldIndex, string fieldValue, string&#x5B;] fieldArray, out string fieldInvalidMessage)\n    {\n        fieldInvalidMessage = &quot;&quot;;\n\n        FieldConstants.UserRegistrationField userRegistrationField = (FieldConstants.UserRegistrationField)fieldIndex;\n\n        switch (userRegistrationField) \n        {\n            case FieldConstants.UserRegistrationField.EmailAddress:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_pattenMatchValidDel(fieldValue, CommonRegularExpressionValidationPatterns.Email_Address_RegEx_Pattern)) ? $&quot;You must enter a valid email address{Environment.NewLine}&quot; : fieldInvalidMessage;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; _emailExistsDel(fieldValue)) ? $&quot;This email address already exists{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n\n            case FieldConstants.UserRegistrationField.FirstName:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_stringLengthValidDel(fieldValue, FirstName_Min_Length, FirstName_Max_Length)) ? $&quot;{Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)} must be between {FirstName_Min_Length} and {FirstName_Max_Length}{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            case FieldConstants.UserRegistrationField.LastName:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_stringLengthValidDel(fieldValue, LastName_Min_Length, LastName_Max_Length)) ? $&quot;{Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)} must be between {LastName_Min_Length} and {LastName_Max_Length}{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            case FieldConstants.UserRegistrationField.Password:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_pattenMatchValidDel(fieldValue, CommonRegularExpressionValidationPatterns.Strong_Password_RegEx_Pattern)) ? $&quot;Your password must contain at least 1 small-case letter, 1 capital letter, 1 special character and the length should be between 6-10 letters{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            case FieldConstants.UserRegistrationField.PasswordCompare:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_compareFieldsValidDel(fieldValue, fieldArray&#x5B;(int)FieldConstants.UserRegistrationField.Password])) ? $&quot;Your entry did not match your password{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            case FieldConstants.UserRegistrationField.DateOfBirth:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_dateValidDel(fieldValue, out DateTime validDateTime)) ? $&quot;You didn&#039;t enter a valid date{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            case FieldConstants.UserRegistrationField.PhoneNumber:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_pattenMatchValidDel(fieldValue, CommonRegularExpressionValidationPatterns.Uk_PhoneNumber_RegEx_Pattern)) ? $&quot;You didn&#039;t enter a valid UK phone number{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            case FieldConstants.UserRegistrationField.AddressFirstLine:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                break;\n            case FieldConstants.UserRegistrationField.AddressSecondLine:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                break;\n            case FieldConstants.UserRegistrationField.AddressCity:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                break;\n            case FieldConstants.UserRegistrationField.PostCode:\n                fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n                fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_pattenMatchValidDel(fieldValue, CommonRegularExpressionValidationPatterns.Uk_Post_Code_RegEx_Pattern)) ? $&quot;You didn&#039;t enter a valid UK post code{Environment.NewLine}&quot; : fieldInvalidMessage;\n                break;\n            default:\n                throw new ArgumentException(&quot;This field does not exist&quot;);\n        }\n\n        \/\/ If no other message returned, the field is valid\n        return (fieldInvalidMessage == &quot;&quot;);\n    }\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u05e9\u05de\u05d9\u05e8\u05ea \u05d4\u05e0\u05ea\u05d5\u05e0\u05d9\u05dd<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d7\u05d6\u05d5\u05e8 \u05dc\u05ea\u05d9\u05e7\u05d9\u05d9\u05ea data \u05d5\u05e0\u05d9\u05e6\u05d5\u05e8 Interface \u05d1\u05e9\u05dd IRegister. \u05e0\u05d2\u05d3\u05d9\u05e8 \u05d0\u05ea \u05e4\u05d5\u05e0' Register \u05e9\u05ea\u05e7\u05d1\u05dc \u05d0\u05ea \u05d4\u05e2\u05e8\u05db\u05d9\u05dd \u05d4\u05ea\u05e7\u05d9\u05e0\u05d9\u05dd \u05e9\u05dc \u05d4\u05d8\u05d5\u05e4\u05e1 \u05d5\u05ea\u05e9\u05dc\u05d7 \u05d0\u05d5\u05ea\u05dd \u05dc\u05e9\u05de\u05d9\u05e8\u05d4 \u05d1-DB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IRegister.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic interface IRegister\n{\n    \/\/ Valid field data from the user input -&gt; to save to the DB\n    bool Register(string&#x5B;] fields);\n    bool EmailExists(string emailAddress);\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 \u05e2\u05d5\u05d3 Interface \u05d1\u05e9\u05dd ILogin \u05e9\u05d9\u05e7\u05d1\u05dc \u05d0\u05ea \u05e4\u05e8\u05d8\u05d9 \u05d4\u05db\u05e0\u05d9\u05e1\u05d4 \u05d5\u05d9\u05d7\u05d6\u05d9\u05e8 \u05d0\u05ea \u05d4\u05de\u05e9\u05ea\u05de\u05e9 \u05d4\u05de\u05ea\u05d0\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ILogin.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic interface ILogin\n{\n    User Login(string emailAddress, string password);\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 class \u05dc\u05de\u05d9\u05de\u05d5\u05e9 IRegister \u05d1\u05e9\u05dd RegisterUser. \u05e0\u05d5\u05e1\u05d9\u05e3 \u05d0\u05ea using ClubMembershipApp.FieldValidators; \u05d1\u05e8\u05d0\u05e9 \u05d4\u05e7\u05d5\u05d1\u05e5 \u05db\u05d3\u05d9 \u05e9\u05ea\u05d4\u05d9\u05d4 \u05dc\u05e0\u05d5 \u05d2\u05d9\u05e9\u05d4 \u05dc-constants \u05e9\u05dc \u05d4\u05d0\u05d9\u05e0\u05d3\u05e7\u05e1\u05d9\u05dd \u05e9\u05dc \u05d4\u05e9\u05d3\u05d5\u05ea \u05e2\u05dd \u05d4\u05e9\u05de\u05d5\u05ea \u05e9\u05dc\u05d4\u05dd. \u05d0\u05d7\u05e8\u05d9 \u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d5\u05e1\u05d9\u05e3 \u05d0\u05d5\u05ea\u05d5 \u05dc-DB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>RegisterUser.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class RegisterUser : IRegister\n{\n    public bool EmailExists(string emailAddress)\n    {\n        throw new NotImplementedException();\n    }\n\n    public bool Register(string&#x5B;] fields)\n    {\n        using(var dbContext = new ClubMembershipDbContext()) \n        {\n            User user = new User\n            {\n                EmailAddress = fields&#x5B;(int)FieldConstants.UserRegistrationField.EmailAddress],\n                FirstName = fields&#x5B;(int)FieldConstants.UserRegistrationField.FirstName],\n                LastName = fields&#x5B;(int)FieldConstants.UserRegistrationField.LastName],\n                Password = fields&#x5B;(int)FieldConstants.UserRegistrationField.Password],\n                DateOfBirth = DateTime.Parse(fields&#x5B;(int)FieldConstants.UserRegistrationField.DateOfBirth]),\n                PhoneNumber = fields&#x5B;(int)FieldConstants.UserRegistrationField.PhoneNumber],\n                AddressFirstLine = fields&#x5B;(int)FieldConstants.UserRegistrationField.AddressFirstLine],\n                AddressSecondtLine = fields&#x5B;(int)FieldConstants.UserRegistrationField.AddressSecondtLine],\n                AddressCity = fields&#x5B;(int)FieldConstants.UserRegistrationField.AddressCity],\n                PostCode = fields&#x5B;(int)FieldConstants.UserRegistrationField.PostCode],\n            };\n\n            dbContext.Users.Add(user);\n            dbContext.SaveChanges();\n        }\n        return true;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05e9\u05d0\u05e8 \u05dc\u05e0\u05d5 \u05e2\u05d5\u05d3 \u05dc\u05de\u05de\u05e9 \u05d0\u05ea \u05d4\u05e4\u05d5\u05e0' \u05e9\u05d1\u05d5\u05d3\u05e7\u05ea \u05d4\u05d0\u05dd \u05d4\u05d0\u05d9\u05de\u05d9\u05d9\u05dc \u05e7\u05d9\u05d9\u05dd.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic bool EmailExists(string emailAddress)\n{\n    bool emailExists = false;\n\n    using(var dbContext = new ClubMembershipDbContext()) \n    {\n        emailExists = dbContext.Users.Any(user =&gt; user.EmailAddress.ToLower().Trim() == emailAddress.ToLower().Trim());\n    }\n\n    return emailExists;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 class \u05dc\u05de\u05d9\u05de\u05d5\u05e9 ILogin \u05d1\u05e9\u05dd LoginUser. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class LoginUser : ILogin\n{\n    public User Login(string emailAddress, string password)\n    {\n        User user = null;\n\n        using (var dbContext = new ClubMembershipDbContext()) {\n            user = dbContext.Users.FirstOrDefault(u =&gt; u.EmailAddress.Trim().ToLower() == emailAddress.Trim().ToLower() &amp;&amp; u.Password.Equals(password));\n        }\n        return user;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d5\u05e2\u05db\u05e9\u05d9\u05d5 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d7\u05d6\u05d5\u05e8 \u05dc-email validator<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>UserRegistrationValidator.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; highlight: [6,26]; title: ; notranslate\" title=\"\">\nIRegister? _register = null;\n\npublic void InitialiseValidatorDelegates()\n{\n    _fieldValidatorDel = new FieldValidatorDel(ValidateField);\n    _emailExistsDel = new EmailExistsDel(_register.EmailExists);\n\n    _requiredValidDel = CommonFieldValidatorFunctions.RequiredFieldValidDel;\n    _stringLengthValidDel = CommonFieldValidatorFunctions.StringLengthFieldValid;\n    _dateValidDel = CommonFieldValidatorFunctions.DateFieldValidDel;\n    _pattenMatchValidDel = CommonFieldValidatorFunctions.PattenMatchValidDel;\n    _compareFieldsValidDel = CommonFieldValidatorFunctions.FieldsCompareValidDel;\n}\n\nprivate bool ValidateField(int fieldIndex, string fieldValue, string&#x5B;] fieldArray, out string fieldInvalidMessage)\n{\n    fieldInvalidMessage = &quot;&quot;;\n\n    FieldConstants.UserRegistrationField userRegistrationField = (FieldConstants.UserRegistrationField)fieldIndex;\n\n    switch (userRegistrationField) \n    {\n        case FieldConstants.UserRegistrationField.EmailAddress:\n            fieldInvalidMessage = (!_requiredValidDel(fieldValue)) ? $&quot;You must enter a value for field: {Enum.GetName(typeof(FieldConstants.UserRegistrationField), userRegistrationField)}{Environment.NewLine}&quot; : &quot;&quot;;\n            fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_pattenMatchValidDel(fieldValue, CommonRegularExpressionValidationPatterns.Email_Address_RegEx_Pattern)) ? $&quot;You must enter a valid email address{Environment.NewLine}&quot; : fieldInvalidMessage;\n            fieldInvalidMessage = (fieldInvalidMessage == &quot;&quot; &amp;&amp; !_emailExistsDel(fieldValue)) ? $&quot;This email address already exists{Environment.NewLine}&quot; : fieldInvalidMessage;\n            break;\n\n...\n}\n\npublic UserRegistrationValidator(IRegister register)\n{\n    _register = register;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d5\u05e1\u05d9\u05e3 2 classes \u05ea\u05d5\u05de\u05db\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>CommonOutputText.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic static class CommonOutputText\n{\n    private static string MainHeading\n    {\n        get\n        {\n            string heading = &quot;Cycling Club&quot;;\n            return $&quot;{heading}{Environment.NewLine}{new string(&#039;-&#039;, heading.Length)}&quot;;\n        }\n    }\n\n    private static string RegistrationHeading\n    {\n        get\n        {\n            string heading = &quot;Register&quot;;\n            return $&quot;{heading}{Environment.NewLine}{new string(&#039;-&#039;, heading.Length)}&quot;;\n        }\n    }\n\n    private static string LoginHeading\n    {\n        get\n        {\n            string heading = &quot;Login&quot;;\n            return $&quot;{heading}{Environment.NewLine}{new string(&#039;-&#039;, heading.Length)}&quot;;\n        }\n    }\n\n    public static void WriteMainHeading()\n    {\n        Console.Clear();\n        Console.WriteLine(MainHeading);\n        Console.WriteLine();\n        Console.WriteLine();\n    }\n\n    public static void WriteLoginHeading()\n    {\n        Console.Clear();\n        Console.WriteLine(MainHeading);\n        Console.WriteLine();\n        Console.WriteLine();\n    }\n\n    public static void WriteRegistrationHeading()\n    {\n        Console.Clear();\n        Console.WriteLine(MainHeading);\n        Console.WriteLine();\n        Console.WriteLine();\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>CommonOutputFormat.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic enum FontTheme\n{\n    Default,\n    Danger,\n    Success\n}\n\npublic static class CommonOutputFormat\n{\n    public static void ChangeFontColor(FontTheme fontTheme)\n    {\n        if(fontTheme == FontTheme.Danger) {\n            Console.BackgroundColor = ConsoleColor.Red;\n            Console.ForegroundColor = ConsoleColor.White;\n        }\n        else if (fontTheme == FontTheme.Success) {\n            Console.BackgroundColor = ConsoleColor.Green;\n            Console.ForegroundColor = ConsoleColor.White;\n        } else {\n            Console.ResetColor();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05ea\u05e6\u05d5\u05d2\u05d4<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d9\u05d4 \u05d7\u05d3\u05e9\u05d4 Views.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IView.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic interface IView\n{\n    void RunView();\n    IFieldValidator FieldValidator { get; set; }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>UserRegistrationView.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserRegistrationView : IView\n{\n    IFieldValidator _fieldValidator = null;\n    IRegister _register = null;\n\n    public IFieldValidator FieldValidator { get =&gt; _fieldValidator; }\n\n    public UserRegistrationView(IRegister register, IFieldValidator fieldValidator)\n    {\n        _fieldValidator = fieldValidator;\n        _register = register;\n    }\n\n    public void RunView()\n    {\n        CommonOutputText.WriteRegistrationHeading();\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.EmailAddress] = GetInputFromUser(FieldConstants.UserRegistrationField.EmailAddress, &quot;Please enter your email address: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.FirstName] = GetInputFromUser(FieldConstants.UserRegistrationField.FirstName, &quot;Please enter your first name: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.LastName] = GetInputFromUser(FieldConstants.UserRegistrationField.LastName, &quot;Please enter your last name: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.Password] = GetInputFromUser(FieldConstants.UserRegistrationField.Password, $&quot;Please enter your password.\n            {Environment.NewLine}Your password must contain at least 1 small-case letter,{Environment.NewLine}1 Capital letter, 1 digit, 1 special character{Environment.NewLine} and the length should be between 6-10 characters: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.PasswordCompare] = GetInputFromUser(FieldConstants.UserRegistrationField.PasswordCompare, &quot;Please re-enter your email address: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.DateOfBirth] = GetInputFromUser(FieldConstants.UserRegistrationField.DateOfBirth, &quot;Please enter your date of birth: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.AddressFirstLine] = GetInputFromUser(FieldConstants.UserRegistrationField.AddressFirstLine, &quot;Please enter your first adress line: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.AddressSecondLine] = GetInputFromUser(FieldConstants.UserRegistrationField.AddressSecondLine, &quot;Please enter your second adress line: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.AddressCity] = GetInputFromUser(FieldConstants.UserRegistrationField.AddressCity, &quot;Please enter your address city: &quot;);\n        _fieldValidator.FieldArray&#x5B;(int)FieldConstants.UserRegistrationField.PostCode] = GetInputFromUser(FieldConstants.UserRegistrationField.PostCode, &quot;Please enter your postal code: &quot;);\n\n        RegisterUser();\n    }\n\n    private void RegisterUser()\n    {\n        _register.Register(_fieldValidator.FieldArray);\n\n        CommonOutputFormat.ChangeFontColor(FontTheme.Success);\n        Console.WriteLine(&quot;You have successfully registered. Please press any key to login.&quot;);\n        CommonOutputFormat.ChangeFontColor(FontTheme.Default);\n    }\n\n    private string GetInputFromUser(FieldConstants.UserRegistrationField field, string promptText)\n    {\n        string fieldVal = &quot;&quot;;\n\n        \/\/ The prompt will go on until a valid field value will be entered.\n        do {\n            Console.Write(promptText);\n            fieldVal = Console.ReadLine();\n        } while (!FieldValid(field, fieldVal));\n\n        return fieldVal;\n    }\n\n    private bool FieldValid(FieldConstants.UserRegistrationField field, string fieldValue)\n    {\n        if (!_fieldValidator.ValidatorDel((int)field, fieldValue, _fieldValidator.FieldArray, out string invalidMessage)) {\n            CommonOutputFormat.ChangeFontColor(FontTheme.Danger);\n            Console.WriteLine(invalidMessage);\n            CommonOutputFormat.ChangeFontColor(FontTheme.Default);\n\n            return false;\n        }\n        return true;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>UserLoginView.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class UserLoginView : IView\n{\n    ILogin _loginUser = null;\n    public IFieldValidator FieldValidator =&gt; null;\n\n    public UserLoginView(ILogin login)\n    {\n        _loginUser = login;\n    }\n\n    public void RunView()\n    {\n        CommonOutputText.WriteMainHeading();\n        CommonOutputText.WriteLoginHeading();\n\n        Console.WriteLine(&quot;Please enter your email address&quot;);\n        string emailAddress = Console.ReadLine();\n\n        Console.WriteLine(&quot;Please enter your password&quot;);\n        string password = Console.ReadLine();\n\n        User user = _loginUser.Login(emailAddress, password);\n        if(user != null) {\n            WelcomeUserView welcomeUserView = new WelcomeUserView(user);\n            welcomeUserView.RunView();\n        } else {\n            Console.Clear();\n            CommonOutputFormat.ChangeFontColor(FontTheme.Danger);\n            Console.WriteLine(&quot;The credentials that you entered do not match any of our records&quot;);\n            CommonOutputFormat.ChangeFontColor(FontTheme.Default);\n            Console.ReadKey();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>WelcomeUserView.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class WelcomeUserView : IView\n{\n    User _user = null;\n\n    public WelcomeUserView(User user)\n    {\n        _user = user;\n    }\n\n    public IFieldValidator FieldValidator =&gt; null;\n\n    public void RunView()\n    {\n        Console.Clear();\n        CommonOutputText.WriteMainHeading();\n\n        CommonOutputFormat.ChangeFontColor(FontTheme.Success);\n        Console.WriteLine($&quot;Hi {_user.FirstName}!!{Environment.NewLine}Welcome to the Cycling Club!!&quot;);\n        CommonOutputFormat.ChangeFontColor(FontTheme.Default);\n        Console.ReadKey();\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>MainView.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class MainView : IView\n{\n    public IFieldValidator FieldValidator =&gt; null;\n\n    IView _registerView = null;\n    IView _loginView = null;\n\n    public MainView(IView registerView, IView loginView)\n    {\n        _registerView = registerView;\n        _loginView = loginView;\n    }\n    public void RunView()\n    {\n        CommonOutputText.WriteMainHeading();\n\n        Console.WriteLine(&quot;Please press &#039;l&#039; to login or if you are not yet registered please press &#039;r&#039;&quot;);\n        ConsoleKey key = Console.ReadKey().Key;\n\n        if (key == ConsoleKey.R) {\n            RunUserRegistrationView();\n            RunLoginView();\n        }\n        else if (key == ConsoleKey.L) {\n            RunLoginView();\n        }\n        else {\n            Console.Clear();\n            Console.WriteLine(&quot;Goodbye&quot;);\n            Console.ReadKey();\n        }\n    }\n\n    private void RunUserRegistrationView()\n    {\n        _registerView.RunView();\n    }\n\n    private void RunLoginView()\n    {\n        _loginView.RunView();\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05ea\u05d7\u05ea \u05d4\u05ea\u05d9\u05e7\u05d9\u05d9\u05d4 \u05d4\u05e8\u05d0\u05e9\u05d9\u05ea \u05e0\u05d9\u05e6\u05d5\u05e8 \u05e7\u05d5\u05d1\u05e5 Factory. \u05d1-main view \u05d9\u05e9 \u05dc\u05e0\u05d5 \u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8\u05d9\u05dd \u05e9\u05e0\u05d5\u05e6\u05e8\u05d9\u05dd \u05de-ILogin \u05d5-IRegister. \u05de\u05db\u05d9\u05d5\u05d5\u05df \u05e9\u05e9\u05e0\u05d9\u05d4\u05dd \u05de\u05e9\u05de\u05e9\u05d9\u05dd \u05d0\u05ea IView \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05ea\u05d7\u05d6\u05d9\u05e8 \u05d0\u05ea \u05d4-view \u05d4\u05de\u05ea\u05d0\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Factory.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic static class Factory\n{\n    public static IView GetMainViewObject()\n    {\n        ILogin login = new LoginUser();\n        IRegister register = new RegisterUser();\n        IFieldValidator userRegistrationValidator = new UserRegistrationValidator(register);\n        userRegistrationValidator.InitialiseValidatorDelegates();\n\n        IView registerView = new UserRegistrationView(register, userRegistrationValidator);\n        IView loginView = new UserLoginView(login);\n        IView mainView = new MainView(registerView, loginView);\n\n        return mainView;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05ea\u05d5\u05db\u05e0\u05d9\u05ea \u05d4\u05e8\u05d0\u05e9\u05d9\u05ea \u05e0\u05d9\u05e6\u05d5\u05e8 mainView \u05d5\u05e0\u05e8\u05d9\u05e5 \u05d0\u05ea \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d9\u05ea RunView. \u05e0\u05d5\u05db\u05dc \u05dc\u05e2\u05e9\u05d5\u05ea \u05d0\u05ea \u05d6\u05d4 \u05db\u05d9 \u05db\u05dc \u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8 \u05de\u05d5\u05e4\u05e9\u05d8\u05ea.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Program.cs<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nIView mainView = Factory.GetMainViewObject();\nmainView.RunView();\n\nConsole.ReadKey();\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u05e0\u05e8\u05d0\u05d4 \u05e7\u05d5\u05d3 \u05e9\u05de\u05e9\u05ea\u05de\u05e9 \u05d1-delegates \u05d5\u05de\u05e0\u05e6\u05dc \u05d0\u05ea \u05d4\u05d9\u05db\u05d5\u05dc\u05d5\u05ea \u05e9\u05dc\u05d5. \u05e0\u05d1\u05e0\u05d4 \u05d4\u05e8\u05e9\u05de\u05d4 \u05dc\u05de\u05d5\u05e2\u05d3\u05d5\u05df \u05dc\u05d7\u05d1\u05e8\u05d5\u05ea. \u05d4\u05d9\u05ea\u05e8\u05d5\u05df \u05e9\u05dc \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1-delegates \u05d4\u05d5\u05d0 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05e9\u05dc \u05e9\u05d3\u05d5\u05ea. \u05d4\u05de\u05d8\u05e8\u05d4 \u05d4\u05d9\u05d0 \u05dc\u05e0\u05ea\u05e7 \u05d0\u05ea \u05d4\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05d5\u05de\u05e9\u05d3\u05d4 \u05e1\u05e4\u05e6\u05d9\u05e4\u05d9. \u05d9\u05d4\u05d9\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05e7\u05d5\u05d3 \u05d1\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05d5\u05dc\u05d9\u05d9\u05e6\u05e8 \u05e7\u05d5\u05d3 \u05d2\u05de\u05d9\u05e9. \u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 console app (.Net framework) \u05d1\u05e9\u05dd ClubMembershipApplication. \u05d1\u05ea\u05d5\u05da \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d5\u05ea Models \u05e9\u05d1\u05d4 \u05d9\u05d4\u05d9\u05d5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[76],"tags":[],"class_list":["post-1817","post","type-post","status-publish","format-standard","hentry","category-advanced-c-sharp","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Delegates - Code Example - Code Notebook<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/\" \/>\n<meta property=\"og:locale\" content=\"he_IL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Delegates - Code Example - Code Notebook\" \/>\n<meta property=\"og:description\" content=\"\u05e0\u05e8\u05d0\u05d4 \u05e7\u05d5\u05d3 \u05e9\u05de\u05e9\u05ea\u05de\u05e9 \u05d1-delegates \u05d5\u05de\u05e0\u05e6\u05dc \u05d0\u05ea \u05d4\u05d9\u05db\u05d5\u05dc\u05d5\u05ea \u05e9\u05dc\u05d5. \u05e0\u05d1\u05e0\u05d4 \u05d4\u05e8\u05e9\u05de\u05d4 \u05dc\u05de\u05d5\u05e2\u05d3\u05d5\u05df \u05dc\u05d7\u05d1\u05e8\u05d5\u05ea. \u05d4\u05d9\u05ea\u05e8\u05d5\u05df \u05e9\u05dc \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1-delegates \u05d4\u05d5\u05d0 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05e9\u05dc \u05e9\u05d3\u05d5\u05ea. \u05d4\u05de\u05d8\u05e8\u05d4 \u05d4\u05d9\u05d0 \u05dc\u05e0\u05ea\u05e7 \u05d0\u05ea \u05d4\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05d5\u05de\u05e9\u05d3\u05d4 \u05e1\u05e4\u05e6\u05d9\u05e4\u05d9. \u05d9\u05d4\u05d9\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05e7\u05d5\u05d3 \u05d1\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05d5\u05dc\u05d9\u05d9\u05e6\u05e8 \u05e7\u05d5\u05d3 \u05d2\u05de\u05d9\u05e9. \u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 console app (.Net framework) \u05d1\u05e9\u05dd ClubMembershipApplication. \u05d1\u05ea\u05d5\u05da \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d5\u05ea Models \u05e9\u05d1\u05d4 \u05d9\u05d4\u05d9\u05d5 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Notebook\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-14T08:07:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-23T08:59:29+00:00\" \/>\n<meta name=\"author\" content=\"kerendanino\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u05e0\u05db\u05ea\u05d1 \u05e2\u05dc \u05d9\u05d3\" \/>\n\t<meta name=\"twitter:data1\" content=\"kerendanino\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u05d6\u05de\u05df \u05e7\u05e8\u05d9\u05d0\u05d4 \u05de\u05d5\u05e2\u05e8\u05da\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u05d3\u05e7\u05d5\u05ea\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/\"},\"author\":{\"name\":\"kerendanino\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/person\\\/195dfc625818eadda7903d456890e24c\"},\"headline\":\"Delegates &#8211; Code Example\",\"datePublished\":\"2024-10-14T08:07:42+00:00\",\"dateModified\":\"2024-10-23T08:59:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/\"},\"wordCount\":211,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#organization\"},\"articleSection\":[\"C# \u05dc\u05de\u05ea\u05e7\u05d3\u05de\u05d9\u05dd\"],\"inLanguage\":\"he-IL\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/\",\"name\":\"Delegates - Code Example - Code Notebook\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#website\"},\"datePublished\":\"2024-10-14T08:07:42+00:00\",\"dateModified\":\"2024-10-23T08:59:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/#breadcrumb\"},\"inLanguage\":\"he-IL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/delegates-code-example\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Delegates &#8211; Code Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#website\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/\",\"name\":\"Code Notebook\",\"description\":\"Easy coding\",\"publisher\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"he-IL\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#organization\",\"name\":\"Code Notebook\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"he-IL\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo-epic-marketing-05.png\",\"contentUrl\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo-epic-marketing-05.png\",\"width\":3626,\"height\":1942,\"caption\":\"Code Notebook\"},\"image\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/person\\\/195dfc625818eadda7903d456890e24c\",\"name\":\"kerendanino\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"he-IL\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g\",\"caption\":\"kerendanino\"},\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/author\\\/kerendanino\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Delegates - Code Example - Code Notebook","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/","og_locale":"he_IL","og_type":"article","og_title":"Delegates - Code Example - Code Notebook","og_description":"\u05e0\u05e8\u05d0\u05d4 \u05e7\u05d5\u05d3 \u05e9\u05de\u05e9\u05ea\u05de\u05e9 \u05d1-delegates \u05d5\u05de\u05e0\u05e6\u05dc \u05d0\u05ea \u05d4\u05d9\u05db\u05d5\u05dc\u05d5\u05ea \u05e9\u05dc\u05d5. \u05e0\u05d1\u05e0\u05d4 \u05d4\u05e8\u05e9\u05de\u05d4 \u05dc\u05de\u05d5\u05e2\u05d3\u05d5\u05df \u05dc\u05d7\u05d1\u05e8\u05d5\u05ea. \u05d4\u05d9\u05ea\u05e8\u05d5\u05df \u05e9\u05dc \u05e9\u05d9\u05de\u05d5\u05e9 \u05d1-delegates \u05d4\u05d5\u05d0 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05dc\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05e9\u05dc \u05e9\u05d3\u05d5\u05ea. \u05d4\u05de\u05d8\u05e8\u05d4 \u05d4\u05d9\u05d0 \u05dc\u05e0\u05ea\u05e7 \u05d0\u05ea \u05d4\u05d5\u05dc\u05d9\u05d3\u05e6\u05d9\u05d4 \u05d5\u05de\u05e9\u05d3\u05d4 \u05e1\u05e4\u05e6\u05d9\u05e4\u05d9. \u05d9\u05d4\u05d9\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05e7\u05d5\u05d3 \u05d1\u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05d5\u05dc\u05d9\u05d9\u05e6\u05e8 \u05e7\u05d5\u05d3 \u05d2\u05de\u05d9\u05e9. \u05d9\u05e6\u05d9\u05e8\u05ea \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 console app (.Net framework) \u05d1\u05e9\u05dd ClubMembershipApplication. \u05d1\u05ea\u05d5\u05da \u05d4\u05e4\u05e8\u05d5\u05d9\u05d9\u05e7\u05d8 \u05e0\u05d9\u05e6\u05d5\u05e8 \u05ea\u05d9\u05e7\u05d9\u05d5\u05ea Models \u05e9\u05d1\u05d4 \u05d9\u05d4\u05d9\u05d5 [&hellip;]","og_url":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/","og_site_name":"Code Notebook","article_published_time":"2024-10-14T08:07:42+00:00","article_modified_time":"2024-10-23T08:59:29+00:00","author":"kerendanino","twitter_card":"summary_large_image","twitter_misc":{"\u05e0\u05db\u05ea\u05d1 \u05e2\u05dc \u05d9\u05d3":"kerendanino","\u05d6\u05de\u05df \u05e7\u05e8\u05d9\u05d0\u05d4 \u05de\u05d5\u05e2\u05e8\u05da":"5 \u05d3\u05e7\u05d5\u05ea"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/#article","isPartOf":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/"},"author":{"name":"kerendanino","@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/person\/195dfc625818eadda7903d456890e24c"},"headline":"Delegates &#8211; Code Example","datePublished":"2024-10-14T08:07:42+00:00","dateModified":"2024-10-23T08:59:29+00:00","mainEntityOfPage":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/"},"wordCount":211,"commentCount":0,"publisher":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#organization"},"articleSection":["C# \u05dc\u05de\u05ea\u05e7\u05d3\u05de\u05d9\u05dd"],"inLanguage":"he-IL","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/","url":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/","name":"Delegates - Code Example - Code Notebook","isPartOf":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#website"},"datePublished":"2024-10-14T08:07:42+00:00","dateModified":"2024-10-23T08:59:29+00:00","breadcrumb":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/#breadcrumb"},"inLanguage":"he-IL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/epicmarketing.co.il\/notebook\/delegates-code-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/epicmarketing.co.il\/notebook\/"},{"@type":"ListItem","position":2,"name":"Delegates &#8211; Code Example"}]},{"@type":"WebSite","@id":"https:\/\/epicmarketing.co.il\/notebook\/#website","url":"https:\/\/epicmarketing.co.il\/notebook\/","name":"Code Notebook","description":"Easy coding","publisher":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/epicmarketing.co.il\/notebook\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"he-IL"},{"@type":"Organization","@id":"https:\/\/epicmarketing.co.il\/notebook\/#organization","name":"Code Notebook","url":"https:\/\/epicmarketing.co.il\/notebook\/","logo":{"@type":"ImageObject","inLanguage":"he-IL","@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/logo\/image\/","url":"https:\/\/epicmarketing.co.il\/notebook\/wp-content\/uploads\/2023\/07\/logo-epic-marketing-05.png","contentUrl":"https:\/\/epicmarketing.co.il\/notebook\/wp-content\/uploads\/2023\/07\/logo-epic-marketing-05.png","width":3626,"height":1942,"caption":"Code Notebook"},"image":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/person\/195dfc625818eadda7903d456890e24c","name":"kerendanino","image":{"@type":"ImageObject","inLanguage":"he-IL","@id":"https:\/\/secure.gravatar.com\/avatar\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g","caption":"kerendanino"},"url":"https:\/\/epicmarketing.co.il\/notebook\/author\/kerendanino\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts\/1817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/comments?post=1817"}],"version-history":[{"count":20,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts\/1817\/revisions"}],"predecessor-version":[{"id":1928,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts\/1817\/revisions\/1928"}],"wp:attachment":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/media?parent=1817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/categories?post=1817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/tags?post=1817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}