Skip to content
Discussion options

You must be logged in to vote

I found this sample in unittest :

so cool :)

private readonly struct RaftLogEntry : IRaftLogEntry
    {
        private readonly ReadOnlyMemory<byte> content;
        private readonly bool knownLength;

        internal RaftLogEntry(long term, byte[] content, bool knownLength)
        {
            Term = term;
            Timestamp = DateTimeOffset.UtcNow;
            this.content = content;
            this.knownLength = knownLength;
        }

        public long Term { get; }

        public DateTimeOffset Timestamp { get; }

        bool IDataTransferObject.IsReusable => true;

        long? IDataTransferObject.Length => knownLength ? content.Length : null;

        ValueTask IDataTr…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by guillaume-chervet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant