Created
July 15, 2020 04:14
-
-
Save pranavkm/c696decc4b7706d3f39a0db54ac11fbe 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