当前位置: 首页>>代码示例>>C#>>正文


C# Tuple.All方法代码示例

本文整理汇总了C#中Tuple.All方法的典型用法代码示例。如果您正苦于以下问题:C# Tuple.All方法的具体用法?C# Tuple.All怎么用?C# Tuple.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tuple的用法示例。


在下文中一共展示了Tuple.All方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitQueueUnspentTxLookup

        private static TransformManyBlock<DecodedBlockTx, Tuple<TxOutputKey, CompletionCount, DecodedBlockTx>> InitQueueUnspentTxLookup(CancellationToken cancelToken)
        {
            return new TransformManyBlock<DecodedBlockTx, Tuple<TxOutputKey, CompletionCount, DecodedBlockTx>>(
                blockTx =>
                {
                    var tx = blockTx.Transaction;

                    var outputCount = tx.Outputs.Length;
                    var inputCount = !blockTx.IsCoinbase ? tx.Inputs.Length * 2 : 0;

                    var txOutputKeys = new Tuple<TxOutputKey, CompletionCount, DecodedBlockTx>[1 + outputCount + inputCount];
                    var completionCount = new CompletionCount(txOutputKeys.Length);
                    var keyIndex = 0;

                    // warm-up the UnspentTx entry that will be added for the new tx
                    txOutputKeys[keyIndex++] = Tuple.Create(new TxOutputKey(blockTx.Hash, uint.MaxValue), completionCount, blockTx);

                    // warm-up the TxOutput entries that will be added for each of the tx's outputs
                    for (var outputIndex = 0; outputIndex < tx.Outputs.Length; outputIndex++)
                    {
                        var txOutputKey = new TxOutputKey(blockTx.Hash, (uint)outputIndex);
                        txOutputKeys[keyIndex++] = Tuple.Create(txOutputKey, completionCount, blockTx);
                    }

                    // warm-up the previous UnspentTx and TxOutput entries that will be needed for each of the tx's inputs
                    if (!blockTx.IsCoinbase)
                    {
                        for (var inputIndex = 0; inputIndex < tx.Inputs.Length; inputIndex++)
                        {
                            var input = tx.Inputs[inputIndex];

                            // input's previous tx's UnspentTx entry
                            var txOutputKey = new TxOutputKey(input.PrevTxHash, uint.MaxValue);
                            txOutputKeys[keyIndex++] = Tuple.Create(txOutputKey, completionCount, blockTx);

                            // input's previous tx outputs's TxOutput entry
                            txOutputKey = input.PrevTxOutputKey;
                            txOutputKeys[keyIndex++] = Tuple.Create(txOutputKey, completionCount, blockTx);
                        }
                    }

                    Debug.Assert(txOutputKeys.All(x => x != null));

                    return txOutputKeys;
                },
                new ExecutionDataflowBlockOptions { CancellationToken = cancelToken });
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:47,代码来源:UtxoLookAhead.cs


注:本文中的Tuple.All方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。