✅ Is it worth to use record in this situation?
I have following class that describes specification:
It is specification so it should be readonly as I think.. Is it worth to use record?
using Newtonsoft.Json;
public class Specification
{
/// <summary>
/// states that this schema complies with v4 of the IETF standard
/// </summary>
[JsonProperty(PropertyName = "schema")]
public string? Schema { get; set; }
/// <summary>
/// defines the base url to resolve other uri references within the schema
/// </summary>
[JsonProperty(PropertyName = "id")]
public string? Id { get; set; }
/// <summary>
/// describes the intent of the schema
/// </summary>
[JsonProperty(PropertyName = "title")]
public string? Title { get; set; }
/// <summary>
/// gives the description of the schema
/// </summary>
[JsonProperty(PropertyName = "description")]
public string? Description { get; set; }
/// <summary>
/// defines the type of data
/// </summary>
[JsonProperty(PropertyName = "type")]
public string? Type { get; set; }
/// <summary>
/// defines various keys and their value types within a json document
/// </summary>
[JsonProperty(PropertyName = "properties")]
public IEnumerable<string>? Properties { get; set; }
/// <summary>
/// defines the minimum acceptable value for a string datatype
/// </summary>
[JsonProperty(PropertyName = "minLength")]
public int MinLength { get; set; }
/// <summary>
/// defines the minimum acceptable value for a numeric datatype
/// </summary>
[JsonProperty(PropertyName = "minimum")]
public int Minimum { get; set; }
/// <summary>
/// enumerates the definition for the items that can appear in an array
/// </summary>
[JsonProperty(PropertyName = "items")]
public IEnumerable<string>? Items { get; set; }
}
using Newtonsoft.Json;
public class Specification
{
/// <summary>
/// states that this schema complies with v4 of the IETF standard
/// </summary>
[JsonProperty(PropertyName = "schema")]
public string? Schema { get; set; }
/// <summary>
/// defines the base url to resolve other uri references within the schema
/// </summary>
[JsonProperty(PropertyName = "id")]
public string? Id { get; set; }
/// <summary>
/// describes the intent of the schema
/// </summary>
[JsonProperty(PropertyName = "title")]
public string? Title { get; set; }
/// <summary>
/// gives the description of the schema
/// </summary>
[JsonProperty(PropertyName = "description")]
public string? Description { get; set; }
/// <summary>
/// defines the type of data
/// </summary>
[JsonProperty(PropertyName = "type")]
public string? Type { get; set; }
/// <summary>
/// defines various keys and their value types within a json document
/// </summary>
[JsonProperty(PropertyName = "properties")]
public IEnumerable<string>? Properties { get; set; }
/// <summary>
/// defines the minimum acceptable value for a string datatype
/// </summary>
[JsonProperty(PropertyName = "minLength")]
public int MinLength { get; set; }
/// <summary>
/// defines the minimum acceptable value for a numeric datatype
/// </summary>
[JsonProperty(PropertyName = "minimum")]
public int Minimum { get; set; }
/// <summary>
/// enumerates the definition for the items that can appear in an array
/// </summary>
[JsonProperty(PropertyName = "items")]
public IEnumerable<string>? Items { get; set; }
}
0 Replies