This repository was archived by the owner on Apr 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 331
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
c#: Add ToString() implementations for compiled bond objects #1171
Copy link
Copy link
Open
Labels
Description
Bond version: 10.0.0
it seems that when compiling bond objects for c# (and possibly other languages) that there is no ToString() override, so when printing out a bond object in a logger, it just prints the object's name, which is not desirable.
Example:
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> cat C:\Users\mgrandi\Temp\record.bond
struct Record
{
0: string Name;
1: vector<double> Constants;
}
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64>
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> .\gbc-10.0.0-amd64.exe c# C:\Users\mgrandi\Temp\record.bond
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> ls
Directory: C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/7/2022 6:53 PM 53646880 gbc-10.0.0-amd64.exe
-a---- 9/20/2022 1:13 PM 1484 record_types.cs
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> cat .\record_types.cs
//------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Tool : Bond Compiler 0.12.1.0
// Input filename: C:\Users\mgrandi\Temp\record.bond
// Output filename: record_types.cs
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// <auto-generated />
//------------------------------------------------------------------------------
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace test
{
using System.Collections.Generic;
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")]
public partial class Record
{
[global::Bond.Id(0)]
public string Name { get; set; }
[global::Bond.Id(1)]
public List<double> Constants { get; set; }
public Record()
: this("test.Record", "Record")
{}
protected Record(string fullName, string name)
{
Name = "";
Constants = new List<double>();
}
}
} // test