Skip to main content


C# (pronounced see sharp) is a general-purpose, high-level multi-paradigm programming language.

concerto compile --model test.cto --target csharp


  • @DotNetType("") - this decorator can be used to map a field to dotnet specific data type.

Allowed data types -


Note: The CSharp codegen performs a check to ensure that the configured data type is among the allowed data types, but it doesn't verify compatibility between the configured CTO type and .NET type.

  • @AcceptedValue("") - this decorator can be used to configure custom value for an enum field.

Eg, test.cto

namespace test@1.0.0

concept Person identified by email {
o String email
o DateTime dob optional
o Double currencyValue

enum RenewalType {
@AcceptedValue("automatic renewal")
o AutomaticRenewal
@AcceptedValue("optional renewal")
o OptionalRenewal

Sample Output

namespace Test;
using AccordProject.Concerto;
[AccordProject.Concerto.Type(Namespace = "test", Version = "1.0.0", Name = "Person")]
public class Person : Concept {
public override string _Class { get; } = "test@1.0.0.Person";
public string Email { get; set; }
public System.DateTime? Dob { get; set; }
public decimal CurrencyValue { get; set; }

public enum RenewalType {
[System.Runtime.Serialization.EnumMember(Value = "automatic renewal")]
[System.Runtime.Serialization.EnumMember(Value = "optional renewal")]


  • useSystemTextJson: compile for System.Text.Json library
  • useNewtonsoftJson: compile for Newtonsoft.Json library
  • namespacePrefix: a prefix to add to all namespaces
  • pascalCase: use PascalCase for generated identifier names
  • enableReferenceType: use enableReferenceType to add only the identifier of the relationship property instead of embedding the entire class


  1. Scalars are unboxed as properties