h2o-bindings/bin/gen_csharp.py
def generate_schema(class_name, schema):
    """
    Generate C# declaration file for a schema.
    """
    has_map = False
    for field in schema["fields"]:
        if field["type"].startswith("Map"): has_map = True

    superclass = schema["superclass"]
    if superclass == "Iced": superclass = "Object"

    yield "/**"
    yield " * This file is auto-generated by h2o-3/h2o-bindings/bin/gen_csharp.py"
    yield " * Copyright 2016 H2O.ai;  Apache License Version 2.0 (see LICENSE for details)"
    yield " */"
    yield "namespace ai.h2o"
    yield "{"
    yield "  using System;"
    yield "  using System.Collections.Generic;" if has_map else None
    yield ""
    yield "  public class {name}: {super} {{".format(name=class_name, super=superclass)

    for field in schema["fields"]:
        if field["name"] == "__meta": continue
        csharp_type = translate_type(field["type"], field["schema_name"])
        yield "    /// <summary>"
        yield bi.wrap(field["help"], "    ///   ")
        yield "    /// </summary>"
        yield "    public {type} {name} {{ get; set; }}".format(type=csharp_type, name=field["name"])
        yield ""

    yield "  }"
    yield "}"
def generate_schema(class_name, schema):
    """
    Generate C# declaration file for a schema.
    """
    has_map = False
    for field in schema["fields"]:
        if field["type"].startswith("Map"): has_map = True

    superclass = schema["superclass"]
    if superclass == "Iced": superclass = "Object"

    yield "/**"
    yield " * This file is auto-generated by h2o-3/h2o-bindings/bin/gen_csharp.py"
    yield " * Copyright 2016 H2O.ai;  Apache License Version 2.0 (see LICENSE for details)"
    yield " */"
    yield "namespace ai.h2o"
    yield "{"
    yield "  using System;"
    yield "  using System.Collections.Generic;" if has_map else None
    yield ""
    yield "  public class {name}: {super} {{".format(name=class_name, super=superclass)

    for field in schema["fields"]:
        if field["name"] == "__meta": continue
        csharp_type = translate_type(field["type"], field["schema_name"])
        yield "    /// <summary>"
        yield bi.wrap(field["help"], "    ///   ")
        yield "    /// </summary>"
        yield "    public {type} {name} {{ get; set; }}".format(type=csharp_type, name=field["name"])
        yield ""

    yield "  }"
    yield "}"
Generate C# declaration file for a schema.