Skip to content

Instantly share code, notes, and snippets.

@stijnmoreels
Last active November 15, 2019 08:53
Show Gist options
  • Save stijnmoreels/9d4ce491068fdd863e4fc63b32541171 to your computer and use it in GitHub Desktop.
Save stijnmoreels/9d4ce491068fdd863e4fc63b32541171 to your computer and use it in GitHub Desktop.
public class BookJson
{
[JsonConstructor]
public BookJson(string author, string isbn13, int pages)
{
Author = Sanitize.RegexReplace(pattern: "( ){2,}", replacement: String.Empty, input: author).WhiteMatch(@"[a-zA-Z\. ]+");
ISBN13 = Sanitize.RemoveWhitespace(isbn13).BlackList(@"\-");
Pages = pages;
}
[JsonProperty("author")]
public string Author { get; }
[JsonProperty("isbn13")]
public string ISBN13 { get; }
[JsonProperty("pages")]
public int Pages { get; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment