Skip to content

Constructor of DataBlockDataItem<Boolean> could us wrong constructor #61

Description

@AndreDrubig

After changing yesterday to V0.15 I had to adjust my code using the DataBlockDataItem constructor and adding the arguments to this:

signalDataItem = new DataBlockDataItem<Boolean>(dataBlockNumber, byteAddress, bitAddress);

Because there is a constructor like

public DataBlockDataItem(BigEndianShort dbNumber, int startByte, int length = 1) : this(dbNumber, startByte, 0, length)

it used this one instead of the one I intended to use:

public DataBlockDataItem(BigEndianShort dbNumber, int startByte, int bit, int length = 1)

If I the make an item with bit address '0' if have got an ArgumentOutOfRangeException of Length is 0

To use the correct constructor I now add the parameter names like this:

signalDataItem = new DataBlockDataItem<Boolean>(dbNumber: dataBlockNumber, startByte: byteAddress, bit: bitAddress);

and it is fine.

I don't know if there is some better way of making the constructor for an boolean so that it can not use by mistake the constructor without the bit address.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions