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


C# ImmutableDictionary.ToImmutable方法代码示例

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


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

示例1: CommitTransaction

        public void CommitTransaction(ChainedHeader chainTip, int? unspentTxCount, int? unspentOutputCount, int? totalTxCount, int? totalInputCount, int? totalOutputCount, ImmutableSortedDictionary<UInt256, ChainedHeader>.Builder headers, ImmutableSortedDictionary<UInt256, UnspentTx>.Builder unspentTransactions, ImmutableDictionary<int, BlockSpentTxes>.Builder blockSpentTxes, ImmutableDictionary<UInt256, IImmutableList<UnmintedTx>>.Builder blockUnmintedTxes, long chainVersion, long unspentTxCountVersion, long unspentOutputCountVersion, long totalTxCountVersion, long totalInputCountVersion, long totalOutputCountVersion, long headersVersion, long unspentTxesVersion, long blockSpentTxesVersion, long blockUnmintedTxesVersion)
        {
            lock (this.lockObject)
            {
                if (chainTip != null && this.chainTipVersion != chainVersion
                    || unspentTxCount != null && unspentTxCountVersion != this.unspentTxCountVersion
                    || unspentOutputCount != null && unspentOutputCountVersion != this.unspentOutputCountVersion
                    || totalTxCount != null && totalTxCountVersion != this.totalTxCountVersion
                    || totalInputCount != null && totalInputCountVersion != this.totalInputCountVersion
                    || totalOutputCount != null && totalOutputCountVersion != this.totalOutputCountVersion
                    || headers != null && headersVersion != this.headersVersion
                    || unspentTransactions != null && unspentTxesVersion != this.unspentTxesVersion
                    || blockSpentTxes != null && blockSpentTxesVersion != this.blockSpentTxesVersion
                    || blockUnmintedTxes != null && blockUnmintedTxesVersion != this.blockUnmintedTxesVersion)
                    throw new InvalidOperationException();

                if (chainTip != null)
                {
                    this.chainTip = chainTip;
                    this.chainTipVersion++;
                }

                if (unspentTxCount != null)
                {
                    this.unspentTxCount = unspentTxCount.Value;
                    this.unspentTxCountVersion++;
                }

                if (unspentOutputCount != null)
                {
                    this.unspentOutputCount = unspentOutputCount.Value;
                    this.unspentOutputCountVersion++;
                }

                if (totalTxCount != null)
                {
                    this.totalTxCount = totalTxCount.Value;
                    this.totalTxCountVersion++;
                }

                if (totalInputCount != null)
                {
                    this.totalInputCount = totalInputCount.Value;
                    this.totalInputCountVersion++;
                }

                if (totalOutputCount != null)
                {
                    this.totalOutputCount = totalOutputCount.Value;
                    this.totalOutputCountVersion++;
                }

                if (headers != null)
                {
                    this.headers = headers.ToImmutable().ToBuilder();
                    this.headersVersion++;
                }

                if (unspentTransactions != null)
                {
                    this.unspentTransactions = unspentTransactions.ToImmutable().ToBuilder();
                    this.unspentTxesVersion++;
                }

                if (blockSpentTxes != null)
                {
                    this.blockSpentTxes = blockSpentTxes.ToImmutable().ToBuilder();
                    this.blockSpentTxesVersion++;
                }

                if (blockUnmintedTxes != null)
                {
                    this.blockUnmintedTxes = blockUnmintedTxes.ToImmutable().ToBuilder();
                    this.blockUnmintedTxesVersion++;
                }
            }
        }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:77,代码来源:MemoryChainStateStorage.cs


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