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


C# Block.Clone方法代码示例

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


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

示例1: Clone

 public void Clone()
 {
     var block = new Block { BlockType = new BlockType() };
     var result = block.Clone() as Block;
     Assert.NotNull( result );
     Assert.NotNull( result.BlockType );
 }
开发者ID:NewSpring,项目名称:Rock,代码行数:7,代码来源:BlockTests.cs

示例2: VisitBlock

    public virtual Differences VisitBlock(Block block1, Block block2){
      Differences differences = new Differences(block1, block2);
      if (block1 == null || block2 == null){
        if (block1 != block2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Block changes = (Block)block2.Clone();
      Block deletions = (Block)block2.Clone();
      Block insertions = (Block)block2.Clone();

      if (block1.Checked == block2.Checked) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;

      StatementList statChanges, statDeletions, statInsertions;
      Differences diff = this.VisitStatementList(block1.Statements, block2.Statements, out statChanges, out statDeletions, out statInsertions);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Statements = statChanges;
      deletions.Statements = statDeletions;
      insertions.Statements = statInsertions;
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      if (block1.SuppressCheck == block2.SuppressCheck) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:34,代码来源:Comparer.cs

示例3: LookupBlock

		public Block LookupBlock (Block from)
		{
			Block result;
			if (!block_map.TryGetValue (from, out result)) {
				result = (Block) from.Clone (this);
			}

			return result;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:9,代码来源:context.cs

示例4: ShouldCopyProperties

 public void ShouldCopyProperties()
 {
     var block = new Block { Name = "Foo" };
     var result = block.Clone( false );
     Assert.AreEqual( result.Name, block.Name );
 }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:6,代码来源:BlockTests.cs

示例5: VisitBlock

 public override Block VisitBlock(Block block)
 {
     if (block == null) return null;
     Block dup = (Block)this.DuplicateFor[block.UniqueKey];
     if (dup != null) return dup;
     this.DuplicateFor[block.UniqueKey] = dup = (Block)block.Clone();
     return base.VisitBlock(dup);
 }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:8,代码来源:Duplicator.cs

示例6: ShallowClone

 public void ShallowClone()
 {
     var block = new Block { Name = "Foo" };
     var result = block.Clone( false );
     Assert.Equal( result.Name, block.Name );
 }
开发者ID:NewSpring,项目名称:Rock,代码行数:6,代码来源:BlockTests.cs

示例7: BlockAndValidity

        public BlockAndValidity(Dictionary<uint256, int> blockToHeightMap, Dictionary<uint256, Block> hashHeaderMap, Block block,
            bool connects, bool throwsException, uint256 hashChainTipAfterBlock, int heightAfterBlock, String blockName)
            : base(blockName)
        {
            if(connects && throwsException)
                throw new InvalidOperationException("A block cannot connect if an exception was thrown while adding it.");
            this.block = block;
            this.blockHash = block.GetHash();
            this.connects = connects;
            this.throwsException = throwsException;
            this.hashChainTipAfterBlock = hashChainTipAfterBlock;
            this.heightAfterBlock = heightAfterBlock;

            // Keep track of the set of blocks indexed by hash
            hashHeaderMap.AddOrReplace(block.GetHash(), block.Clone());

            // Double-check that we are always marking any given block at the same height
            int height = 0;
            ;
            if(blockToHeightMap.TryGetValue(hashChainTipAfterBlock, out height))
                Assert.True(height == heightAfterBlock);
            else
                blockToHeightMap.Add(hashChainTipAfterBlock, heightAfterBlock);
        }
开发者ID:nikropht,项目名称:NBitcoin,代码行数:24,代码来源:FullBlockTestGenerator.cs


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