simple-binary-encoding icon indicating copy to clipboard operation
simple-binary-encoding copied to clipboard

[C#] Add missing generated code comments

Open MFrpurdy opened this issue 4 years ago • 0 comments

For a few generated methods, including the new string-based setter/getters that I recently added, the method comments are missing.

    /// <summary>
    /// Vehicle code from Car
    /// </summary>
    public Span<byte> VehicleCodeAsSpan()
    {
        return _buffer.AsSpan<byte>(_offset + 28, VehicleCodeLength);
    }

    public int GetVehicleCode(byte[] dst, int dstOffset)
    {
          const int length = 6;
          return GetVehicleCode(new Span<byte>(dst, dstOffset, length));
    }

    public int GetVehicleCode(Span<byte> dst)
    {
        const int length = 6;
        if (dst.Length < length)
        {
            ThrowHelper.ThrowWhenSpanLengthTooSmall(dst.Length);
        }
    
        _buffer.GetBytes(_offset + 28, dst);
        return length;
    }
   
    public void SetVehicleCode(byte[] src, int srcOffset)
    {
        SetVehicleCode(new ReadOnlySpan<byte>(src, srcOffset, src.Length - srcOffset));
    }
    
    public void SetVehicleCode(ReadOnlySpan<byte> src)
    {
        const int length = 6;
        if (src.Length > length)
        {
            ThrowHelper.ThrowWhenSpanLengthTooLarge(src.Length);
        }
    
        _buffer.SetBytes(_offset + 28, src);
    }
    
    public void SetVehicleCode(string value)
    {
        _buffer.SetNullTerminatedBytesFromString(VehicleCodeResolvedCharacterEncoding, value, _offset + 28, VehicleCodeLength, VehicleCodeNullValue);
    }
    public string GetVehicleCode()
    {
        return _buffer.GetStringFromNullTerminatedBytes(VehicleCodeResolvedCharacterEncoding, _offset + 28, VehicleCodeLength, VehicleCodeNullValue);
    }

MFrpurdy avatar Jun 03 '21 22:06 MFrpurdy