© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago
SWEETPONY

✅ Is it worth to use record in this situation?

I have following class that describes specification:
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; }
}


It is specification so it should be readonly as I think.. Is it worth to use record?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Is it worth to use AsNoTracking in dbset?
C#CC# / help
3y ago
✅ Is it worth to use stackalloc here?
C#CC# / help
16mo ago
❔ Is it worth to create lazy dictionary in this case?
C#CC# / help
4y ago
Is writing tests like this worth it
C#CC# / help
6mo ago