Created
July 15, 2020 04:14
-
-
Save pranavkm/64c55c922b9d607ea2df5d037555e8be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public record Person([FromRoute][Required][StringLength(1, 8)] string id); | |
public record Person | |
{ | |
public Person(string id) => Id = id; | |
[FromRoute][Required][StringLength(1, 8)] | |
public string Id { get; init; } | |
} | |
public class Person | |
{ | |
public Person(string id) => UserId = id; | |
[FromRoute][Required][StringLength(1, 8)] | |
public string UserId { get; } | |
} | |
public class Person | |
{ | |
private string _id; | |
public Person([JsonProperty("UserId")][MaxLength(4)] string id) => _id = id; | |
} | |
public class Person | |
{ | |
public Person([Required][StringLength(1, 8)] string id) => UserId = int.Parse(id); | |
[Range(1, 9999)] | |
public int UserId { get; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment